mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibJS: Implement stringification Temporal.PlainMonthDay prototypes
This commit is contained in:
parent
1a386e78c3
commit
5bccb36a6f
Notes:
github-actions[bot]
2024-11-22 00:25:37 +00:00
Author: https://github.com/trflynn89
Commit: 5bccb36a6f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2471
14 changed files with 238 additions and 7 deletions
|
@ -310,6 +310,24 @@ ThrowCompletionOr<ISODate> calendar_month_day_from_fields(VM& vm, StringView cal
|
|||
return result;
|
||||
}
|
||||
|
||||
// 12.2.13 FormatCalendarAnnotation ( id, showCalendar ), https://tc39.es/proposal-temporal/#sec-temporal-formatcalendarannotation
|
||||
String format_calendar_annotation(StringView id, ShowCalendar show_calendar)
|
||||
{
|
||||
// 1. If showCalendar is NEVER, return the empty String.
|
||||
if (show_calendar == ShowCalendar::Never)
|
||||
return String {};
|
||||
|
||||
// 2. If showCalendar is AUTO and id is "iso8601", return the empty String.
|
||||
if (show_calendar == ShowCalendar::Auto && id == "iso8601"sv)
|
||||
return String {};
|
||||
|
||||
// 3. If showCalendar is CRITICAL, let flag be "!"; else, let flag be the empty String.
|
||||
auto flag = show_calendar == ShowCalendar::Critical ? "!"sv : ""sv;
|
||||
|
||||
// 4. Return the string-concatenation of "[", flag, "u-ca=", id, and "]".
|
||||
return MUST(String::formatted("[{}u-ca={}]", flag, id));
|
||||
}
|
||||
|
||||
// 12.2.15 ISODaysInMonth ( year, month ), https://tc39.es/proposal-temporal/#sec-temporal-isodaysinmonth
|
||||
u8 iso_days_in_month(double year, double month)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue