1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Runtime/BigInt.h>
namespace JS::Temporal {
class PlainDateTime final : public Object {
JS_OBJECT(PlainDateTime, Object);
public:
PlainDateTime(i32 iso_year, u8 iso_month, u8 iso_day, u8 iso_hour, u8 iso_minute, u8 iso_second, u8 iso_millisecond, u8 iso_microsecond, u8 iso_nanosecond, Object& calendar, Object& prototype);
virtual ~PlainDateTime() override = default;
[[nodiscard]] i32 iso_year() const { return m_iso_year; }
[[nodiscard]] u8 iso_month() const { return m_iso_month; }
[[nodiscard]] u8 iso_day() const { return m_iso_day; }
[[nodiscard]] u8 iso_hour() const { return m_iso_hour; }
[[nodiscard]] u8 iso_minute() const { return m_iso_minute; }
[[nodiscard]] u8 iso_second() const { return m_iso_second; }
[[nodiscard]] u8 iso_millisecond() const { return m_iso_millisecond; }
[[nodiscard]] u8 iso_microsecond() const { return m_iso_microsecond; }
[[nodiscard]] u8 iso_nanosecond() const { return m_iso_nanosecond; }
[[nodiscard]] Object const& calendar() const { return m_calendar; }
[[nodiscard]] Object& calendar() { return m_calendar; }
private:
virtual void visit_edges(Visitor&) override;
// 5.4 Properties of Temporal.PlainDateTime Instances, https://tc39.es/proposal-temporal/#sec-properties-of-temporal-plaindatetime-instances
i32 m_iso_year { 0 }; // [[ISOYear]]
u8 m_iso_month { 0 }; // [[ISOMonth]]
u8 m_iso_day { 0 }; // [[ISODay]]
u8 m_iso_hour { 0 }; // [[ISOHour]]
u8 m_iso_minute { 0 }; // [[ISOMinute]]
u8 m_iso_second { 0 }; // [[ISOSecond]]
u16 m_iso_millisecond { 0 }; // [[ISOMillisecond]]
u16 m_iso_microsecond { 0 }; // [[ISOMicrosecond]]
u16 m_iso_nanosecond { 0 }; // [[ISONanosecond]]
Object& m_calendar; // [[Calendar]]
};
BigInt* get_epoch_from_iso_parts(GlobalObject&, i32 year, i32 month, i32 day, i32 hour, i32 minute, i32 second, i32 millisecond, i32 microsecond, i32 nanosecond);
bool iso_date_time_within_limits(GlobalObject&, i32 year, i32 month, i32 day, i32 hour, i32 minute, i32 second, i32 millisecond, i32 microsecond, i32 nanosecond);
PlainDateTime* create_temporal_date_time(GlobalObject&, i32 iso_year, u8 iso_month, u8 iso_day, u8 hour, u8 minute, u8 second, u16 millisecond, u16 microsecond, u16 nanosecond, Object& calendar, FunctionObject* new_target = nullptr);
}
|