mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-18 08:20:44 +00:00
LibJS: Implement the Temporal.Duration constructor
This also includes a stubbed Temporal.Duration.prototype. Until we have re-implemented Temporal.PlainDate/ZonedDateTime, some of Temporal.Duration.compare (and its invoked AOs) are left unimplemented.
This commit is contained in:
parent
eca378a7a3
commit
5fe0d3352d
Notes:
github-actions[bot]
2024-11-21 00:06:22 +00:00
Author: https://github.com/trflynn89
Commit: 5fe0d3352d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2431
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/shannonbooth ✅
30 changed files with 2143 additions and 26 deletions
35
Libraries/LibJS/Runtime/Temporal/ISO8601.h
Normal file
35
Libraries/LibJS/Runtime/Temporal/ISO8601.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/StringView.h>
|
||||
|
||||
namespace JS::Temporal {
|
||||
|
||||
struct ParseResult {
|
||||
Optional<char> sign;
|
||||
Optional<StringView> duration_years;
|
||||
Optional<StringView> duration_months;
|
||||
Optional<StringView> duration_weeks;
|
||||
Optional<StringView> duration_days;
|
||||
Optional<StringView> duration_hours;
|
||||
Optional<StringView> duration_hours_fraction;
|
||||
Optional<StringView> duration_minutes;
|
||||
Optional<StringView> duration_minutes_fraction;
|
||||
Optional<StringView> duration_seconds;
|
||||
Optional<StringView> duration_seconds_fraction;
|
||||
};
|
||||
|
||||
enum class Production {
|
||||
TemporalDurationString,
|
||||
};
|
||||
|
||||
Optional<ParseResult> parse_iso8601(Production, StringView);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue