davidot
1c4c251be3
LibJS+Everywhere: Remove all VM::clear_exception() calls
...
Since VM::exception() no longer exists this is now useless. All of these
calls to clear_exception were just to clear the VM state after some
(potentially) failed evaluation and did not use the exception itself.
2022-02-08 09:12:42 +00:00
Linus Groh
96db8a061b
LibJS: Correct FormatTimeZoneOffsetString arg in CreateTemporalTimeZone
...
This is an editorial change in the Temporal spec (accidentally marked
normative).
See: https://github.com/tc39/proposal-temporal/commit/3039c98
2022-01-25 00:06:49 +00:00
Linus Groh
31283b5e64
LibJS: Pass valid offset string directly to CreateTemporalTimeZone
...
This is an editorial change in the Temporal spec.
See:
- https://github.com/tc39/proposal-temporal/commit/75490b9
- https://github.com/tc39/proposal-temporal/commit/8b70e4b
2022-01-23 00:22:10 +00:00
Linus Groh
6d744eb4a7
LibJS: Use consistent name for offset strings
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/17f8cdb
2022-01-23 00:22:10 +00:00
Timothy Flynn
70f49d0696
LibJS+LibTimeZone+LibUnicode: Indicate whether a time zone is in DST
...
Return whether the time zone is in DST during the provided time from
TimeZone::get_time_zone_offset,
2022-01-19 21:20:41 +00:00
Linus Groh
b9093dd0ab
LibJS: Don't validate time zone name when parsing Instant string
...
This is normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/2a81fbc
2022-01-13 10:08:34 +01:00
Linus Groh
cf6ceb956f
LibJS: Avoid js_string() allocation in parse_time_zone_offset_string()
...
No need to take the spec literally here since we know the input values
are guaranteed to be integral numbers. Use AK string to number parsing
functionality instead and save a couple of PrimitiveString allocations.
This matches what we already do in parse_temporal_time_zone_string().
2022-01-12 21:24:12 +01:00
Timothy Flynn
f6786881aa
LibJS: Implement the ECMA-402 definition of DefaultTimeZone
...
Simply defer to LibTimeZone to retrieve the system's current time zone.
Also update some Temporal tests to explicitly set the time zone to UTC.
2022-01-12 15:43:12 +01:00
Linus Groh
355fbcb702
LibJS: Actually implement get_iana_time_zone_offset_nanoseconds()
...
Instead of hard-coding an UTC offset of zero seconds, which worked for
the sole UTC time zone, we can now get the proper offset from the TZDB!
2022-01-11 22:17:39 +01:00
Linus Groh
d527eb62da
LibJS: Support non-UTC time zones in Temporal :^)
...
We can now recognize & normalize all time zones from the IANA time zone
database and not just 'UTC', which makes the LibJS Temporal
implementation a lot more useful! Thanks to the newly added LibTimeZone,
this was incredibly easy to implement :^)
This already includes these recent editorial changes in the Temporal
spec: https://github.com/tc39/proposal-temporal/commit/27bffe1
2022-01-11 22:17:39 +01:00
Linus Groh
f1276144ba
LibJS: Check if input was exhausted after parsing UTC offset fraction
...
Previously parse_time_zone_numeric_utc_offset_syntax() would return true
to indicate success when parsing a string with an invalid number of
digits in the fractional seconds part (e.g. 23:59:59.9999999999).
We need to check if the lexer has any characters remaining, and return
false if that's the case.
2022-01-11 21:16:33 +01:00
Linus Groh
09a11fa6ea
LibJS: Implement proper Iterator records
...
Instead of using plain objects as Iterator records, causes confusion
about the object itself actually being its [[Iterator]] slot, and
requires non-standard type conversion shenanigans fpr the [[NextValue]]
and [[Done]] internal slots, implement a proper Iterator record struct
and use it throughout.
Also annotate the remaining Iterator AOs with spec comments while we're
here.
2022-01-09 22:02:43 +01:00
Linus Groh
c56e5139f5
LibJS: Fix modulo in get_iso_parts_from_epoch() for negative epoch ns
...
This now matches the spec change from reminder() to modulo which was
done here: https://github.com/tc39/proposal-temporal/commit/bdf60f5
2021-12-22 11:27:31 +01:00
Linus Groh
9c209b8079
LibJS: Support modulo(x, y) with different types
...
It's a bit annoying having to add '.0' to y given that it's an integral
number in most cases.
This turns the single template parameter T into T and U to permit that.
2021-12-22 11:27:31 +01:00
Linus Groh
b70a55bd5a
LibJS: Update spec comment in get_iso_parts_from_epoch()
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/bdf60f5
2021-12-18 22:32:39 +00:00
Linus Groh
3f1af7c05f
LibJS: Update parse_temporal_time_zone() to match the spec again
2021-11-20 23:10:09 +00:00
Linus Groh
2ecb47c985
LibJS: Update spec comments in format_time_zone_offset_string()
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/60c753a
2021-11-19 19:29:18 +00:00
Linus Groh
eaa3329573
LibJS: Fix incorrect use of "modulo" in get_iso_parts_from_epoch()
...
This would return incorrect results for negative inputs. It still does
to some extent, remainder() in step 2 might need to be replaced with
modulo (I opened an issue in tc39/proposal-temporal about that).
2021-11-17 22:31:28 +00:00
Luke Wilde
3666d2132b
LibJS: Remove fallback value for get_offset_nanoseconds_for
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/664f02d
Note that the tests are not comprehensive.
2021-11-17 11:30:13 +00:00
Linus Groh
e93ce1ff69
LibJS: Fix nanoseconds formatting in format_time_zone_offset_string()
...
Two issues:
- The format string said "{:9}", which left-pads with spaces and not
zeros as required
- Even when correcting that, we were not accounting for step 11 b:
"Set fraction to the longest possible substring of fraction starting
at position 0 and not ending with the code unit 0x0030 (DIGIT ZERO)."
We can safely use trim() for that as the formatted string is known to
not contain only zeros (which would leave the left-most in place).
Also adds tests for "UTC" and various numeric offsets.
2021-11-07 20:06:28 +00:00
Linus Groh
68d80d239b
LibJS: Fix fraction substring in parse_time_zone_offset_string()
...
We're supposed to get the substring from `fraction`, which is guaranteed
to have the required length. `fraction_part` is the user-supplied value
and trying to get a substring view from 0-9 might crash.
2021-11-07 20:01:31 +00:00
Luke Wilde
706296374b
LibJS: Implement Temporal.ZonedDateTime.prototype.equals
2021-11-07 15:35:16 +02:00
Linus Groh
dd1a808f7e
LibJS: Remove TODO() from implemented code path
...
Well, that's embarassing. TODO()'d it, implemented it, forgot to remove
the TODO().
2021-11-04 23:59:40 +01:00
Linus Groh
38809f90d9
LibJS: Introduce & use FormatISOTimeZoneOffsetString
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/6b7a993
2021-11-04 16:45:54 +01:00
Linus Groh
97f6c6029f
LibJS: Implement Temporal.TimeZone.prototype.getInstantFor()
2021-11-01 21:39:45 +01:00
Linus Groh
a7cb042ca8
LibJS: Fix format_time_zone_offset_string() for negative offsets
...
This is a normative change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/ec43be3
2021-10-30 23:14:50 +02:00
Linus Groh
92fdae178b
LibJS: Implement Temporal.TimeZone.prototype.getPreviousTransition()
2021-10-30 16:32:20 +02:00
Linus Groh
e9cbeeac45
LibJS: Implement Temporal.TimeZone.prototype.getNextTransition()
2021-10-30 16:32:20 +02:00
Linus Groh
5fde02184d
LibJS: Implement Temporal.TimeZone.prototype.getPossibleInstantsFor()
2021-10-30 16:32:20 +02:00
Linus Groh
09d1db5afd
LibJS: Clarify mathematical types in Temporal AOs and functions
...
This is an editorial change in the Temporal spec.
See: https://github.com/tc39/proposal-temporal/commit/e480d40
2021-10-26 23:10:11 +02:00
Linus Groh
be28a6142b
LibJS: Convert to_integer_or_infinity() to ThrowCompletionOr
2021-10-18 21:24:30 +01:00
Linus Groh
4d8912a92b
LibJS: Convert to_string() to ThrowCompletionOr
...
Also update get_function_name() to use ThrowCompletionOr, but this is
not a standard AO and should be refactored out of existence eventually.
2021-10-13 09:55:10 +01:00
Linus Groh
f38a5957bf
LibJS: Convert has_property() to ThrowCompletionOr
2021-10-03 20:14:03 +01:00
Linus Groh
b7e5f08e56
LibJS: Convert Object::get() to ThrowCompletionOr
...
To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
2021-10-03 20:14:03 +01:00
Idan Horowitz
ee825d6d9e
LibJS: Convert get_method to ThrowCompletionOr
2021-09-23 23:59:13 +03:00
Idan Horowitz
ab594e5f2f
LibJS: Convert Value::invoke and VM::call to ThrowCompletionOr
2021-09-23 23:59:13 +03:00
Linus Groh
d764f1c699
LibJS: Convert PlainDateTime AOs to ThrowCompletionOr
2021-09-17 23:43:01 +02:00
Linus Groh
14f16d9ed4
LibJS: Convert parse_temporal_time_zone_string() to ThrowCompletionOr
2021-09-16 22:34:24 +01:00
Idan Horowitz
cc00a726a8
LibJS: Convert TimeZone AOs to ThrowCompletionOr
2021-09-16 13:53:37 +01:00
Idan Horowitz
830d484d78
LibJS: Change GetISOPartsFromEpoch's return type to ISODateTime
...
This AO can't throw so its optional is never empty.
2021-09-16 13:53:37 +01:00
Idan Horowitz
5a4c90fcb1
LibJS: Convert ordinary_create_from_constructor<T> to ThrowCompletionOr
2021-09-16 13:53:37 +01:00
Linus Groh
e4c07c5b8f
LibJS: Make new_target parameter of all Temporal AOs a const*
...
These are passed to ordinary_create_from_constructor() in each case,
which takes the parameter as a const&, so these can also be const.
2021-09-09 23:46:45 +01:00
Linus Groh
86a7c795f6
LibJS: Use the newly added remainder operation in GetISOPartsFromEpoch
...
This is a normative change in the Temporal spec. No behavioral change,
just a clarification.
See: https://github.com/tc39/proposal-temporal/commit/b7bdc65
2021-09-08 00:07:18 +01:00
Linus Groh
576be0f8e7
LibJS: Implement Temporal.Instant.prototype.toString()
2021-08-31 16:35:51 +02:00
Linus Groh
0cdad283c0
LibJS: Reflect Record wording editorial change in the Temporal spec
...
See: https://github.com/tc39/proposal-temporal/commit/c8f14d0
2021-08-17 21:59:35 +01:00
Linus Groh
16c38788c3
LibJS: Add missing spec links
2021-08-08 11:04:30 +01:00
Linus Groh
6c345c8107
LibJS: Implement Temporal.ZonedDateTime.prototype.offset
2021-08-05 19:19:40 +02:00
Linus Groh
1f5098f61e
LibJS: Handle ZonedDateTime in ToTemporalTimeZone
2021-08-01 20:31:31 +01:00
Linus Groh
e511390423
LibJS: Implement Temporal.TimeZone.prototype.getPlainDateTimeFor()
2021-08-01 10:24:38 +01:00
Linus Groh
c4123d8aad
LibJS: Implement Temporal.TimeZone.prototype.getOffsetStringFor()
2021-08-01 10:24:38 +01:00