/* * Copyright (c) 2021-2023, Linus Groh * Copyright (c) 2024, Tim Flynn * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include namespace JS::Temporal { class JS_API PlainYearMonth final : public Object { JS_OBJECT(PlainYearMonth, Object); GC_DECLARE_ALLOCATOR(PlainYearMonth); public: virtual ~PlainYearMonth() override = default; [[nodiscard]] ISODate iso_date() const { return m_iso_date; } [[nodiscard]] String const& calendar() const { return m_calendar; } private: PlainYearMonth(ISODate, String calendar, Object& prototype); ISODate m_iso_date; // [[ISODate]] String m_calendar; // [[Calendar]] }; JS_API ThrowCompletionOr> to_temporal_year_month(VM&, Value item, Value options = js_undefined()); JS_API bool iso_year_month_within_limits(ISODate); JS_API ISOYearMonth balance_iso_year_month(double year, double month); JS_API ThrowCompletionOr> create_temporal_year_month(VM&, ISODate, String calendar, GC::Ptr new_target = {}); JS_API String temporal_year_month_to_string(PlainYearMonth const&, ShowCalendar); JS_API ThrowCompletionOr> difference_temporal_plain_year_month(VM&, DurationOperation, PlainYearMonth const&, Value other, Value options); JS_API ThrowCompletionOr> add_duration_to_year_month(VM&, ArithmeticOperation, PlainYearMonth const&, Value temporal_duration_like, Value options); }