1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:07:35 +00:00

LibJS: Start implementing Temporal.PlainDate

This commit adds the PlainDate object itself, its constructor and
prototype (currently empty), and several required abstract operations.
This commit is contained in:
Idan Horowitz 2021-07-19 00:29:26 +03:00 committed by Linus Groh
parent ff6ca0f02d
commit cc00ccec41
19 changed files with 465 additions and 5 deletions

View file

@ -423,6 +423,27 @@ Optional<TemporalInstant> parse_temporal_instant_string(GlobalObject& global_obj
return TemporalInstant { .year = result->year, .month = result->month, .day = result->day, .hour = result->hour, .minute = result->minute, .second = result->second, .millisecond = result->millisecond, .microsecond = result->microsecond, .nanosecond = result->nanosecond, .time_zone_offset = move(time_zone_result->offset) };
}
// 13.37 ParseTemporalCalendarString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalcalendarstring
String parse_temporal_calendar_string([[maybe_unused]] GlobalObject& global_object, [[maybe_unused]] String const& iso_string)
{
// 1. Assert: Type(isoString) is String.
// 2. If isoString does not satisfy the syntax of a TemporalCalendarString (see 13.33), then
// a. Throw a RangeError exception.
// 3. Let id be the part of isoString produced by the CalendarName production, or undefined if not present.
Optional<StringView> id_part;
TODO();
// 4. If id is undefined, then
if (!id_part.has_value()) {
// a. Return "iso8601".
return "iso8601";
}
// 5. Return id.
return id_part.value();
}
// 13.40 ParseTemporalDurationString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldurationstring
Optional<TemporalDuration> parse_temporal_duration_string(GlobalObject& global_object, String const& iso_string)
{