mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 17:27:34 +00:00
LibJS: Add the ToTemporalInstant Abstract Operation & its requirements
This is Abstract Operation is required for the majority of InstantConstructor's and InstantPrototype's methods. The implementation is not entirely complete, (specifically 2 of the underlying required abstract operations, ParseTemporalTimeZoneString and ParseISODateTime are missing the required lexing, and as such are TODO()-ed) but the majority of it is done.
This commit is contained in:
parent
141c46feda
commit
b816037739
19 changed files with 888 additions and 13 deletions
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
||||
namespace JS::Temporal {
|
||||
|
||||
struct ISODateTime {
|
||||
i32 year;
|
||||
i32 month;
|
||||
i32 day;
|
||||
i32 hour;
|
||||
i32 minute;
|
||||
i32 second;
|
||||
i32 millisecond;
|
||||
i32 microsecond;
|
||||
i32 nanosecond;
|
||||
Optional<String> calendar;
|
||||
};
|
||||
Optional<ISODateTime> parse_iso_date_time(GlobalObject&, String const& iso_string);
|
||||
struct TemporalInstant {
|
||||
i32 year;
|
||||
i32 month;
|
||||
i32 day;
|
||||
i32 hour;
|
||||
i32 minute;
|
||||
i32 second;
|
||||
i32 millisecond;
|
||||
i32 microsecond;
|
||||
i32 nanosecond;
|
||||
Optional<String> time_zone_offset;
|
||||
};
|
||||
Optional<TemporalInstant> parse_temporal_instant_string(GlobalObject&, String const& iso_string);
|
||||
struct TemporalTimeZone {
|
||||
bool z;
|
||||
Optional<String> offset;
|
||||
Optional<String> name;
|
||||
};
|
||||
Optional<TemporalTimeZone> parse_temporal_time_zone_string(GlobalObject&, String const& iso_string);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue