summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTime.h
blob: 67cf49f7791798b25566d882b89e7da945620eca (plain)
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
/*
 * 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);

}