mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +00:00
LibJS: Implement mathematical Temporal.Duration prototypes
Includes: Temporal.Duration.prototype.negated Temporal.Duration.prototype.abs Temporal.Duration.prototype.add Temporal.Duration.prototype.subtract
This commit is contained in:
parent
55c81482b0
commit
a80523be18
Notes:
github-actions[bot]
2024-11-21 00:06:00 +00:00
Author: https://github.com/trflynn89
Commit: a80523be18
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2431
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/shannonbooth ✅
11 changed files with 591 additions and 0 deletions
|
@ -18,6 +18,11 @@
|
|||
|
||||
namespace JS::Temporal {
|
||||
|
||||
enum class ArithmeticOperation {
|
||||
Add,
|
||||
Subtract,
|
||||
};
|
||||
|
||||
// https://tc39.es/proposal-temporal/#sec-temporal-units
|
||||
enum class Unit {
|
||||
Year,
|
||||
|
@ -56,6 +61,7 @@ struct RelativeTo {
|
|||
};
|
||||
|
||||
ThrowCompletionOr<RelativeTo> get_temporal_relative_to_option(VM&, Object const& options);
|
||||
Unit larger_of_two_temporal_units(Unit, Unit);
|
||||
bool is_calendar_unit(Unit);
|
||||
UnitCategory temporal_unit_category(Unit);
|
||||
ThrowCompletionOr<GC::Ref<Duration>> parse_temporal_duration_string(VM&, StringView iso_string);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue