Linus Groh
7270bbb255
LibJS: Remove outdated comment from parse_temporal_duration_string()
...
This is a normative change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/e7182d3
- https://github.com/tc39/proposal-temporal/commit/6dae066
2021-12-18 22:32:39 +00:00
Timothy Flynn
1039159a6c
LibJS: Change LargerOfTwoTemporalUnits AO to return a StringView
2021-11-30 00:01:07 +00:00
Linus Groh
1e41a8668d
LibJS: Add sign(Crypto::SignedBigInteger const&) overload
2021-11-24 17:53:00 +00:00
Linus Groh
55dbd19a16
LibJS: Update to_largest_temporal_unit() to allow undefined fallback
...
This is required for Temporal.Duration.prototype.round(). Subsequently,
this now returns ThrowCompletionOr<Optional<String>>, which brings the
signature in line with that of to_smallest_temporal_unit().
Much nicer! :^)
2021-11-23 21:03:05 +00:00
Linus Groh
de23f0b68c
LibJS: Start fleshing out an ISO 8601 parser for Temporal
...
This is the start of a parser for the ISO 8601 grammar used in the
Temporal spec:
https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar
We will, on purpose, not use a generic ISO 8601 parser from AK or
similar for two reasons:
- Many AOs make specific assumptions about which productions exist and
access them directly, even when they're part of a larger production.
- The spec says "The grammar deviates from the standard given in ISO
8601 in the following ways:" and then lists 17 of such deviations.
Making that work with a general purpose parser is not worth it.
The public API is not being used anywhere yet, but will be in the next
couple of commits. Likewise, the Production enum will be populated with
all the productions accessed directly (e.g. TemporalDateString).
Many thanks to Ali for showing me how to improve my initial approach
full of macros with a nice RAII helper - it's much nicer :^)
Co-Authored-By: Ali Mohammad Pur <mpfard@serenityos.org>
2021-11-20 23:10:09 +00:00
Linus Groh
ec1e1f4f12
LibJS: Disallow Temporal.Duration input values to be non-integers
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/8c85450
2021-11-17 22:20:59 +00:00
Luke Wilde
ac65fb40d9
LibJS: Implement Temporal.PlainDate.prototype.since
2021-11-16 01:06:07 +00:00
Linus Groh
dbe70e7c55
LibJS: Implement Temporal.Duration.prototype.total()
2021-11-13 18:50:54 +00:00
Luke Wilde
29072f4b09
LibJS: Implement the required AOs for Temporal.Duration.compare
2021-11-11 21:06:54 +00:00
Linus Groh
fdffdc43fa
LibJS: Implement the rest of to_temporal_month_day()
...
Always throws at the moment, because parse_temporal_month_day_string()
is basically a stub, and parse_iso_date_time() isn't functional either.
The spec issue has been resolved though, so I figured we might as well
get one small step further :^)
2021-11-10 22:28:27 +00:00
Luke Wilde
dc72d416b2
LibJS: Implement the required AOs for ZonedDateTime stringifiers
2021-11-10 12:56:56 +00:00
Linus Groh
c3c9ac93d0
LibJS: Implement Temporal.PlainDate.prototype.with()
...
With one caveat: in the PreparePartialTemporalFields AO I made a change
to fix a spec issue that would require the input object to always have a
month or monthCode property.
This is tracked in https://github.com/tc39/proposal-temporal/issues/1910
and may get accepted as-is, in which case we simply need to remove the
NOTE comment.
2021-11-08 22:19:45 +00:00
Linus Groh
b2548393d2
LibJS: Implement Temporal.Duration.prototype.toString()
...
I hereby claim "implemented largest AO in LibJS ever" (450 lines). :^)
2021-11-07 15:31:28 +01:00
Luke Wilde
2b89d2a360
LibJS: Implement ToTemporalZonedDateTime and the required AOs
2021-11-07 15:35:16 +02:00
Linus Groh
d129e1ff29
LibJS: Move common code into RejectObjectWithCalendarOrTimeZone
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/5654fe0
2021-11-04 16:17:26 +01:00
Luke Wilde
d1a5254e41
LibJS: Implement Temporal.PlainDateTime.prototype.round
2021-11-03 19:48:08 +01:00
Linus Groh
d49bbb1da3
LibJS: Implement TODO()'d parts of balance_duration()
...
Massive :yakstack:, so I understand why it was skipped in the first
place :^)
2021-11-02 09:24:35 +01:00
Linus Groh
97f6c6029f
LibJS: Implement Temporal.TimeZone.prototype.getInstantFor()
2021-11-01 21:39:45 +01:00
Andreas Kling
398c181c79
LibJS: Rename PropertyName to PropertyKey
...
Let's use the same name as the spec. :^)
2021-10-24 17:18:07 +02:00
Linus Groh
be28a6142b
LibJS: Convert to_integer_or_infinity() to ThrowCompletionOr
2021-10-18 21:24:30 +01:00
Linus Groh
8b07453bce
LibJS: Add non-BigInt overload of round_number_to_increment()
...
Unlike the spec we chose BigInt for the input and output types here as
it was being used with ℝ(ns), ns being of type BigInt, in one place and
a conversion to double would not be safe.
Since in many places we'll have double input values, let's add a double
overload of this function to avoid awkward conversions and expensive
allocations.
2021-10-07 13:00:24 +01:00
Linus Groh
6b4777c558
LibJS: Convert prepare_temporal_fields() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
9ac426c906
LibJS: Convert to_positive_integer() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
2f56fd48ca
LibJS: Convert parse_temporal_year_month_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
14f16d9ed4
LibJS: Convert parse_temporal_time_zone_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
0ccd11ba5f
LibJS: Convert parse_temporal_time_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
f86fa12deb
LibJS: Convert parse_temporal_duration_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
3c530dec5a
LibJS: Convert parse_temporal_date_time_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
4cb6eaf588
LibJS: Convert parse_temporal_date_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
2e28f0b371
LibJS: Convert parse_temporal_calendar_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
4f487266b4
LibJS: Convert parse_temporal_instant_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
3112de6f35
LibJS: Convert parse_iso_date_time() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
8792fdfdf6
LibJS: Convert reject_temporal_calendar_type() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
8dd45a1ba2
LibJS: Convert validate_temporal_unit_range() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
448a364210
LibJS: Convert to_smallest_temporal_unit() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
92187591dd
LibJS: Convert to_largest_temporal_unit() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
dd483d84f8
LibJS: Convert to_seconds_string_precision() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
f8f074f8a9
LibJS: Convert to_temporal_rounding_increment() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
65d26dd25e
LibJS: Convert to_show_calendar_option() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
509d13cf67
LibJS: Convert to_temporal_rounding_mode() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
9f03647f1f
LibJS: Convert to_temporal_overflow() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
b1e7e62657
LibJS: Convert get_string_or_number_option() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
8d6ac267dc
LibJS: Convert Temporal::get_option() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
08dd1c3e2d
LibJS: Convert get_options_object() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
f2b5ddd167
LibJS: Convert iterable_to_list_of_type() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
683e31e1ff
LibJS: Convert to_integer_throw_on_infinity() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Linus Groh
4be2aeca00
LibJS: Make prepare_temporal_fields() fields Object a const&
...
This only calls Object::get() on the fields Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00
Linus Groh
1d24699ca8
LibJS: Make Temporal to_foo() AO normalized_options Object a const&
...
These only pass the normalized_options Object directly or indirectly to
get_option(), which now takes a const reference.
2021-09-09 23:46:45 +01:00
Linus Groh
a422ea8792
LibJS: Make get_string_or_number_option() options Object a const&
...
This only passes the options Object to get_option(), which now takes a
const reference.
2021-09-09 23:46:45 +01:00
Linus Groh
c099b1b8a5
LibJS: Make get_option() options Object a const&
...
This only calls Object::get() on the options Object, which is
const-qualified.
2021-09-09 23:46:45 +01:00