mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-23 10:50:49 +00:00
LibJS: Implement the Temporal.PlainDate constructor
And the simple Temporal.PlainDate.prototype getters, so that the constructed Temporal.PlainDate may actually be validated.
This commit is contained in:
parent
30fb2bf2e1
commit
a0c55f76e7
Notes:
github-actions[bot]
2024-11-23 13:48:20 +00:00
Author: https://github.com/trflynn89
Commit: a0c55f76e7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2513
Reviewed-by: https://github.com/shannonbooth ✅
30 changed files with 856 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <AK/Types.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/Temporal/AbstractOperations.h>
|
||||
|
||||
namespace JS::Temporal {
|
||||
|
@ -22,7 +23,26 @@ struct ISODate {
|
|||
u8 day { 0 };
|
||||
};
|
||||
|
||||
class PlainDate final : public Object {
|
||||
JS_OBJECT(PlainDate, Object);
|
||||
GC_DECLARE_ALLOCATOR(PlainDate);
|
||||
|
||||
public:
|
||||
virtual ~PlainDate() override = default;
|
||||
|
||||
[[nodiscard]] ISODate iso_date() const { return m_iso_date; }
|
||||
[[nodiscard]] String const& calendar() const { return m_calendar; }
|
||||
|
||||
private:
|
||||
PlainDate(ISODate, String calendar, Object& prototype);
|
||||
|
||||
ISODate m_iso_date; // [[ISODate]]
|
||||
String m_calendar; // [[Calendar]]
|
||||
};
|
||||
|
||||
ISODate create_iso_date_record(double year, double month, double day);
|
||||
ThrowCompletionOr<GC::Ref<PlainDate>> to_temporal_date(VM& vm, Value item, Value options = js_undefined());
|
||||
ThrowCompletionOr<GC::Ref<PlainDate>> create_temporal_date(VM&, ISODate, String calendar, GC::Ptr<FunctionObject> new_target = {});
|
||||
bool iso_date_surpasses(i8 sign, double year1, double month1, double day1, ISODate iso_date2);
|
||||
ThrowCompletionOr<ISODate> regulate_iso_date(VM& vm, double year, double month, double day, Overflow overflow);
|
||||
bool is_valid_iso_date(double year, double month, double day);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue