mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibJS: Implement the Temporal.PlainYearMonth constructor
And the simple Temporal.PlainYearMonth.prototype getters, so that the constructed Temporal.PlainYearMonth may actually be validated.
This commit is contained in:
parent
1c733993e0
commit
b68d67693e
Notes:
github-actions[bot]
2024-11-22 18:56:56 +00:00
Author: https://github.com/trflynn89
Commit: b68d67693e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2496
27 changed files with 926 additions and 3 deletions
39
Libraries/LibJS/Runtime/Temporal/PlainYearMonth.h
Normal file
39
Libraries/LibJS/Runtime/Temporal/PlainYearMonth.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/Temporal/AbstractOperations.h>
|
||||
#include <LibJS/Runtime/Temporal/PlainDate.h>
|
||||
|
||||
namespace JS::Temporal {
|
||||
|
||||
class 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]]
|
||||
};
|
||||
|
||||
ThrowCompletionOr<GC::Ref<PlainYearMonth>> to_temporal_year_month(VM&, Value item, Value options = js_undefined());
|
||||
bool iso_year_month_within_limits(ISODate);
|
||||
ThrowCompletionOr<GC::Ref<PlainYearMonth>> create_temporal_year_month(VM&, ISODate, String calendar, GC::Ptr<FunctionObject> new_target = {});
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue