mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:37:45 +00:00
LibJS: Start implementing Temporal.ZonedDateTime
This commit adds the ZonedDateTime object itself, its constructor and prototype (currently empty), and the CreateTemporalZonedDateTime abstract operation.
This commit is contained in:
parent
1b9b995f93
commit
cfb77b66e5
11 changed files with 297 additions and 1 deletions
39
Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h
Normal file
39
Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue