ladybird/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h
Linus Groh cfb77b66e5 LibJS: Start implementing Temporal.ZonedDateTime
This commit adds the ZonedDateTime object itself, its constructor and
prototype (currently empty), and the CreateTemporalZonedDateTime
abstract operation.
2021-08-01 20:31:31 +01:00

39 lines
1.3 KiB
C++

/*
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Runtime/BigInt.h>
#include <LibJS/Runtime/Object.h>
namespace JS::Temporal {
class ZonedDateTime final : public Object {
JS_OBJECT(ZonedDateTime, Object);
public:
ZonedDateTime(BigInt& nanoseconds, Object& time_zone, Object& calendar, Object& prototype);
virtual ~ZonedDateTime() override = default;
BigInt const& nanoseconds() const { return m_nanoseconds; }
BigInt& nanoseconds() { return m_nanoseconds; }
Object const& time_zone() const { return m_time_zone; }
Object& time_zone() { return m_time_zone; }
Object const& calendar() const { return m_calendar; }
Object& calendar() { return m_calendar; }
private:
virtual void visit_edges(Visitor&) override;
// 6.4 Properties of Temporal.ZonedDateTime Instances, https://tc39.es/proposal-temporal/#sec-properties-of-temporal-zoneddatetime-instances
BigInt& m_nanoseconds; // [[Nanoseconds]]
Object& m_time_zone; // [[TimeZone]]
Object& m_calendar; // [[Calendar]]
};
ZonedDateTime* create_temporal_zoned_date_time(GlobalObject&, BigInt& epoch_nanoseconds, Object& time_zone, Object& calendar, FunctionObject* new_target = nullptr);
}