Commit Graph

764 Commits

Author SHA1 Message Date
Philip Chimento a9c223c60e Temporal: Remove withPlainDate() methods
See tc39/proposal-temporal#2847.
2024-06-13 22:04:16 +02:00
Philip Chimento ea4945c66f Temporal: Remove tests using relativeTo in Duration.p.add/subtract
See tc39/proposal-temporal#2825. This is a mass removal of tests that use
this functionality, in a separate commit for ease of review. Further
adjustments will be made in the following commit.
2024-06-13 13:54:46 +02:00
André Bargull 57b9f154a6 Allow alternative implementations for Chinese lunar calendar 2024-05-29 10:47:09 +02:00
André Bargull efe0b1871f Split yearMonthFromFields/reference-day.js into calendar specific files 2024-05-29 10:47:09 +02:00
Sosuke Suzuki c00830acef Fix description of `fractionalDigits` tests 2024-05-28 15:41:01 +02:00
Philip Chimento 6c6c72b063 Temporal: Adjust tests for Duration rounding fix
A MoveRelativeZonedDateTime step was missing, causing incorrect results.
See https://github.com/tc39/proposal-temporal/issues/2742
2024-05-14 09:24:12 +02:00
Ben Allen 8724a0de23 ListFormats used in DurationFormat/prototype/format/fractions-of-subsecond-units-en.js were missing required `type: "unit"` option 2024-04-29 15:54:34 +02:00
Frank Yung-Fong Tang c2ae5ed5e9 Fix mixed-short-and-numeric.js
The option for the listFormat need to include {type: "unit"}
2024-04-25 10:55:21 +02:00
André Bargull a640565994 Add test for negative zero inputs 2024-04-23 18:27:01 +02:00
André Bargull 859b5c67ef Update numeric-hour-with-zero-minutes-and-non-zero-seconds for new default display of sub-hours units
Numeric "minute" and "seconds" units now default to "always" display, so we have
to add an additional test to cover when "auto" display is used. Additionally add
more inputs to cover all possible test combinations.
2024-04-23 18:27:01 +02:00
André Bargull 19d2a38558 Add tests for negative durations with leading zero unit 2024-04-23 18:27:01 +02:00
André Bargull cadd064174 Use formatDurationFormatPattern for "/numeric-hour-with-zero-minutes-and-non-zero-seconds"
The changes from the first commit allow to use
`formatDurationFormatPattern` for this test.
2024-04-23 18:27:01 +02:00
André Bargull 330ecdd016 Sync partitionDurationFormatPattern with latest spec draft
Sync `partitionDurationFormatPattern` with the latest spec draft and
change it to use an `Intl.DurationFormat` object as the input, so it's
easier to compare it against the spec text and because it allows to test
more inputs.

Includes the fixes for:
- https://github.com/tc39/proposal-intl-duration-format/pull/183
- https://github.com/tc39/proposal-intl-duration-format/pull/184
2024-04-23 18:27:01 +02:00
Ben Allen b37947f3a4 Removed extraneous comment, added roundingMode: 'trunc' to NumberFormat options when fractional digits are formatted to match behaviour of DurationFormat -- doesn't make a difference with these test values, but could with others 2024-04-23 11:30:16 +02:00
Sosuke Suzuki 23c3e0111b Use space instead of tab in comments 2024-04-15 11:11:23 -07:00
Ben Allen 046dff4b33
test formatting when microseconds or nanoseconds are the first numeric-styled unit (#4034)
* test formatting when microseconds or nanoseconds are the first numeric-styled unit

* incorporated Philip Chimento guidance re: padding fractional components
2024-04-11 17:02:37 -07:00
Ben Allen e11ef85b1b
added test for formatting mixture of short and numeric styles (#4033)
* added test for formatting mixture of short and numeric styles

* incorporated Philip Chimento feedback re: making test more general across locales
2024-04-11 16:29:13 -07:00
Frank Tang b37b6f3552 Fix incorrect tests landed in PR3890
https://github.com/tc39/test262/pull/3890
2024-04-11 16:33:56 +02:00
Ben Allen e0a0c27796
DurationFormat: added tests for default styles for units following numeric-styled units (#4032) 2024-04-03 18:09:00 +02:00
Philip Chimento 63933d1da5 Temporal: Tests that dateStyle affects toLocaleString output
For each Temporal type, add a test (which should not be sensitive to the
exact locale format) that ensures dateStyle affects the output, for a
Gregorian and non-Gregorian calendar.

See https://github.com/tc39/proposal-temporal/issues/2058
2024-04-03 12:32:46 +02:00
Philip Chimento a074d97c5b Temporal: Tests for conversion of ISO 8601 string to ISO 8601 calendar
See https://github.com/tc39/proposal-temporal/issues/2105. This was not
covered yet in test262.
2024-04-03 12:32:46 +02:00
Philip Chimento b4b574fca1 Temporal: argument-propertybag-calendar-year-zero testing the wrong thing
These tests were supposed to test an invalid ISO string being used as the
`calendar` property in a property bag. Instead they were testing being
used as an invalid ISO string directly where a PlainDate input was needed.
(That is also already covered elsewhere.)
2024-04-03 12:32:46 +02:00
Philip Chimento 0c12b84244 Temporal: Add tests for incorrectly capitalized annotation keys
As per IETF, annotation keys may only consist of lowercase letters,
dashes, and digits, and an optional leading underscore. Uppercase letters
are non-syntactical. Add tests covering this.
2024-04-03 12:32:46 +02:00
Ben Allen 634933a489 DurationFormat: test formatting for units using combinations of "long", "short", and "narrow" styles 2024-03-27 09:49:09 -07:00
Ben Allen 86b6eee25b Correct Intl.DateTimeFormat and Intl.DisplayNames metadata incorrectly identifying tests for 'en' locale as tests for 'en-US' 2024-03-26 09:13:11 -07:00
Ben Allen 39168e26c8 DurationFormat: changed metadata to list 'en' instead of 'en-US' as locale for tests that actually test 'en' rather than 'en-US' 2024-03-25 15:36:57 -07:00
Kevin Gibbons 961480ac61 remove some auto-generated error messages in "assert.throws" tests 2024-03-25 12:09:10 +01:00
Ben Allen 0b1abd5ee7
Two tests previously assumed 'en' as locale for DurationFormat, assumption now made explicit (#4019) 2024-03-15 09:35:47 +01:00
Ben Allen af3890a10a update to reflect numeric minutes handling after https://github.com/tc39/proposal-intl-duration-format/pull/180 2024-03-13 12:00:37 +01:00
André Bargull 263ed65292 Remove locales with explicit u-hc Unicode extension
The tests are passing an explicit `hour12` option, which disables any
`hourCycle` option and any `u-hc` Unicode extension. Therefore passing
input locales with `u-hc` is invalid.

```js
let locale = "en-u-hc-h24";
let hcDefault = new Intl.DateTimeFormat(locale, { hour: "numeric" }).resolvedOptions().hourCycle;

assert.sameValue(hcDefault, "h24", "hour-cycle through Unicode extension");

let hc24 = new Intl.DateTimeFormat(locale, { hour: "numeric", hour12: false }).resolvedOptions().hourCycle;

// Incorrect assertion, because |hc24| uses |hour12|, which disables any
// hour-cycle option and the hour-cycle is determined from the locale "en".
// That means |hc24| will be "h23".
assert.sameValue(hc24, hcDefault);
```
2024-03-08 16:15:08 -08:00
Frank Yung-Fong Tang a2597599bc Add test for ECMA402 PR846
the calenar name should be canonicalized
Spec change https://github.com/tc39/ecma402/pull/846
2024-02-23 15:53:00 -08:00
Aditi 0fd1675f7e Temporal: Add weekOfYear() and yearOfWeek() tests for custom calendars 2024-02-21 10:40:18 -08:00
Aditi ae8fe25b5a Temporal: Tests for week-numbering algorithm 2024-02-21 10:40:18 -08:00
André Bargull 53984cf8c5
Add test with non-IANA time zone names (#4005)
Time zone identifiers supported by ICU, but which aren't valid IANA
identifiers.

Implementations not supporting ECMA-402 are theoretically allowed to
support these identifiers, so the tests have to go into the "intl402"
directory.
2024-02-12 12:06:04 +01:00
Ben Allen 80590ce79a Added tests to verify that use of "long", "short", or "narrow" styles for units following units using "numeric" or "2-digit" styles throws 2024-01-10 14:50:08 +01:00
Michael Dyck c194ad6936 Delete extra slash in Copyright section 2024-01-08 16:04:41 +01:00
Frank Tang 96727cae1c Add test for firstDayOfWeek in LocaleInfo PR 70
Test for enhancement in
https://github.com/tc39/proposal-intl-locale-info/pull/70
2023-11-10 18:11:03 -08:00
André Bargull 873f260478 Update likely subtags tests for CLDR 44 2023-11-08 13:48:33 +01:00
Ben Allen 99ac701b43
Test invalid region tags in Intl.DisplayNames.prototype.of() (#3900) 2023-11-07 15:09:53 +01:00
Philip Chimento f4377a7cf0 Temporal: Fix test to check for TypeError with only one of era/eraYear
These tests were incorrect, in checking for a RangeError when only one of
the era/eraYear fields were given. From CalendarResolveFields:

"The operation throws a *TypeError* exception if the properties of
_fields_ are internally inconsistent within the calendar or insufficient
to identify a unique instance of _type_ in the calendar."
2023-10-26 12:37:43 -04:00
Philip Chimento dab8ccc5df Temporal: Add more coverage for non-ISO PlainMonthDay underspecification
Built-in non-ISO calendars require either monthCode/day, or month/day plus
some form of year specification.

This adds test coverage for each of the categories listed in
https://github.com/tc39/proposal-temporal/issues/2664, of which some must
currently reside in the test/intl402/ folders.
2023-10-26 12:37:43 -04:00
Philip Chimento 8bc3dbb234 Temporal: Move non-ISO calendar tests to intl402/
We'll do this for now, then separately work on migrating all of the tests
that require a non-ISO8601 calendar but aren't dependent on it being any
particular calendar.
2023-10-26 12:37:43 -04:00
Ben Allen d2a6e21ff9 added missing features: line to metadata for two tests 2023-10-04 15:06:25 -07:00
Ben Allen 47eb8dd685
Update to reflect normative change in formatting when Intl.DurationFormat's fractionalDigits option is undefined (#3890) 2023-10-03 13:32:13 +02:00
Ben Allen 5e6f25bb4f added clarifying comments on hourCycle-dateStyle.js 2023-10-02 14:39:52 -07:00
Ben Allen 5606c3012e corrected hourCycle-default.js to handle language tags with -u-hc-h24 extension 2023-10-02 14:39:52 -07:00
Ben Allen 800d136d96 updated hourCycle-default.js to reflect new behaviour of hourCycle, which now associates h12 with h23 rather than h24. see https://github.com/tc39/ecma402/pull/758. 2023-10-02 14:39:52 -07:00
Ben Allen 63456adb38 created type-language-invalid.js for DisplayNames.prototype.of()
Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2023-10-02 14:01:04 -07:00
Frank Yung-Fong Tang 6789b50cce
Add test for ECMA402 PR 788 (#3917)
* Add test for ECMA402 PR 788

https://github.com/tc39/ecma402/pull/788

* Fix misunderstanding about "+00:00"

* Fix lint

* Swap actual, expected position

* Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-basic.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/resolvedOptions/offset-timezone-change.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/constructor-invalid-offset-timezone.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/format/offset-timezone-gmt-same.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/DateTimeFormat/prototype/formatToParts/offset-timezone-correct.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

---------

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2023-09-26 09:22:50 -07:00
Frank Yung-Fong Tang b5fd799fa0
Add Tests for ECMA402 PR811 (#3911)
* Add Tests for ECMA402 PR811

Add tests to check the order of option readings and output
keys in resolvedOptions of Intl.NumberFormat and PluralRules.

* Address reveiw feedback

Hard code the list of property to be inspect for GetOption
Use compareArray

* Update test/intl402/NumberFormat/constructor-option-read-order.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/NumberFormat/constructor-option-read-order.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/NumberFormat/prototype/resolvedOptions/return-keys-order-default.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/PluralRules/constructor-option-read-order.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update test/intl402/PluralRules/constructor-option-read-order.js

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Fix intl402/PluralRules/prototype/resolvedOptions/return-keys-order-default.js

To test all options

* Add more tests

---------

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
2023-09-26 08:58:27 -07:00
André Bargull 16fc2e5e18 Use correct variables in time zone case insensitive test
Also remove `US/Pacific-New` which has been removed from tz data since
release 2020b.
2023-09-22 09:02:08 -07:00
Frank Yung-Fong Tang 3c9b3913b2
Add Collator test for ignorePunctuation (#3913)
Test the explicit setting of ignorePunctuation in the option bag
reflect to the value in resolvedOptions() under Thai and
other locales. (Thai is a special case)

Test the behavior of the compare sync with the value of
resolvedOptions().ignorePunctuation
2023-09-13 17:48:22 +02:00
André Bargull 99096762ca Use verifyProperty in remaining test/intl402 tests 2023-09-13 16:05:40 +02:00
André Bargull f32dc36f3e Use verifyProperty in test/intl402/PluralRules tests 2023-09-13 16:05:40 +02:00
André Bargull ad3f1a6ade Use verifyProperty in test/intl402/NumberFormat tests 2023-09-13 16:05:40 +02:00
André Bargull fe2c17bf4b Use verifyProperty in test/intl402/DateTimeFormat tests 2023-09-13 16:05:40 +02:00
André Bargull 967b16500a Use verifyProperty in test/intl402/Collator tests 2023-09-13 16:05:40 +02:00
Frank Tang bba19d51ae Sync Intl Locale API tests w/ PR67
https://github.com/tc39/proposal-intl-locale-info/pull/67
2023-09-13 16:01:07 +02:00
Philip Chimento a74fbada42 Temporal: Don't observably iterate array in built-in calendar's fields()
Note the monkeypatch of getPossibleInstantsFor in test/built-ins/Temporal/
TimeZone/prototype/getInstantFor/argument-builtin-calendar-no-array-
iteration.js.

Other than that, all the tests are basically identical.
2023-09-13 10:57:43 +02:00
André Bargull e27c9f690c Add DurationFormat test for negative durations 2023-08-28 16:18:47 +02:00
André Bargull fa3581986f Add test for numeric hours with zero minutes and non-zero seconds 2023-08-28 16:18:47 +02:00
André Bargull c9548956f9 Test exact precision for DurationFormat
`Intl.DurationFormat` is currently spec'ed to use unlimited precision.

See: https://github.com/tc39/proposal-intl-duration-format/issues/157
2023-08-28 16:18:47 +02:00
André Bargull 71091f1541 Use simplified PartitionDurationFormatPattern to computed expected results 2023-08-28 16:18:47 +02:00
André Bargull 4da0b8f005 Remove test which duplicates 'style-default-en.js' 2023-08-28 16:18:47 +02:00
Yusuke Suzuki 04a84fc5fd Fix test/intl402/DurationFormat/prototype/format/style-digital-en.js
The expected output is not aligned: it is missing comma. This change fixes it.
2023-08-21 15:37:04 -07:00
Justin Grant 2e4e0e6b8e Test ISO sub-minute offsets, incl. trailing zeroes
Plugs a test hole where we were not fully testing ISO strings with
sub-minute offsets, in particular those with trailing zeroes.
2023-08-10 10:13:27 +02:00
Ben Allen 1499c2c62b updated to contain ES5 version of RGN suggestion 2023-08-09 12:18:42 -07:00
Justin Grant 2e1d7a72ff Test rejecting ISO strings with subminute offsets
This commit verifies that ISO strings with sub-minute offsets cannot
be parsed into time zone identifiers. This was a change introduced in
the recently-merged tc39/proposal-temporal#2607, but tests for this case
were missing from #3862 (the tests for that PR).

I noticed in codecov results on an unrelated PR that this case wasn't
being tested, so fixing that mistake now.
2023-08-09 11:37:39 -07:00
Justin Grant 29dde1ce0e Tests for new API Temporal.TimeZone.p.equals 2023-08-07 15:01:16 -07:00
Justin Grant 90f5cac987 Add Intl.DTF tests for proposal-canonical-tz 2023-08-07 15:01:16 -07:00
Justin Grant a53f190e1f Add ZonedDateTime tests for proposal-canonical-tz 2023-08-07 15:01:16 -07:00
Justin Grant 3032242269 Test Temporal.TimeZone ID case normalization 2023-08-07 15:01:16 -07:00
Justin Grant 5d261f3641 Fix existing tests broken by proposal-canonical-tz 2023-08-07 15:01:16 -07:00
Ben Allen a5e2cf2433
Update InitializeDateTimeFormat references to new CreateDateTimeFormat to reflect recent editorial change (#3889) 2023-08-07 17:01:48 +02:00
Ben Allen 5d9dc53a19
Test invalid Intl.DateTimeFormat options when dateStyle/timeStyle is set (#3886)
Co-authored-by: Ms2ger <Ms2ger@gmail.com>
2023-08-07 16:32:44 +02:00
André Bargull 21c3097f92 Update tests for PR "Read date-time options only once when creating DateTimeFormat objects"
Update tests for PR tc39/ecma402#709.
2023-07-27 21:08:25 +02:00
Frank Yung-Fong Tang 92a9eca159
Add tests for ECMA402 PR 786 (#3875)
https://github.com/tc39/ecma402/pull/786

This ECMA402 PR 786 reached TC39 consensus in the July 2023 meeting
2023-07-24 17:47:19 +02:00
Justin Grant 6f146e6f30 Limit offset time zones to minute precision
Modify/add tests for https://github.com/tc39/proposal-temporal/pull/2607
2023-07-18 17:44:19 +02:00
Justin Grant 60e475248d Tests for Temporal PR #2574
Edits Temporal tests to account for changes in
https://github.com/tc39/proposal-temporal/pull/2574.

This PR stops coercing non-string primitive inputs to strings
in Temporal methods, to avoid cases where numbers
are coerced to syntactically valid but often unexpected
string results.
2023-07-18 17:09:04 +02:00
Guillaume Emont 016e4bf8e8
Temporal Issue 2532 (#3858)
* Add tests for the new PrepareTemporalFields behavior for all direct callers

See https://github.com/tc39/proposal-temporal/pull/2570

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalDate

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalDateTime

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalZonedDateTime

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalYearMonth

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToTemporalMonthDay

* Add tests for the new PrepareTemporalFields behavior for indirect callers through ToRelativeTemporalObject

* Add tests for the new PrepareTemporalFields behavior for indirect callers through AddDurationToOrSubtractDurationFromPlainYearMonth
2023-07-17 07:55:34 -07:00
Frank Tang 9d7eb8018e Correct DurationFormat test
The expectation values for the formatToParts are incorrect.

A. The listFormat is consturcted with
  6. Perform ! CreateDataPropertyOrThrow(lfOpts, "type", "unit").
  so it should not have " and " in the string. Comparing with
  (new Intl.ListFormat("en", {type: "unit"})).formatToParts(["a", "b",
  "c"]) and
  value in the format d and the expected values in the
  DurationFormat/prototype/format directory
B. The localized unit values for "short" (and therefore default)
   are incorrect. Comparing with the expected values in the
  DurationFormat/prototype/format directory
2023-07-14 19:13:30 +02:00
André Bargull f4e31fc397 Update expected test results for CLDR 43
intl402/Locale/constructor-non-iana-canon.js
- Likely subtags entry for "hyw" -> "hyw-Armn-AM" was added to supplemental/likelySubtags.xml

intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js
- Likely subtags entry for "aae" -> "aae-Latn-IT" was added to supplemental/likelySubtags.xml
- Likely subtags entry for "pap" was changed from "pap_Latn_AW" to "pap_Latn_CW"
2023-05-31 09:26:12 -07:00
Philip Chimento 3e858ef02d Tests for multiple calendar annotations with at least one critical
As per IETF review, an IXDTF string (ISO 8601 with annotations) is no
longer valid if it contains more than one u-ca annotation and at least one
of the annotations is marked critical.

Removes tests where such a string was assumed to be valid, and adds new
ones with a few variations on invalid strings.
2023-05-24 13:12:40 -07:00
Aditi 2df6c7d29a Added test for non-iso calendars for Temporal.PlainMonthDay.from 2023-04-18 12:09:26 -07:00
Philip Chimento 801a5bb8f5 Temporal: Port toLocaleString calendar mismatch tests from staging
I wrote a similar test for Temporal.ZonedDateTime.p.toLocaleString, so
while this was fresh I decided to do the same for the other toLocaleString
calendar mismatch tests that were in staging.
2023-04-11 11:52:40 +02:00
Philip Chimento cd714a9aad Temporal: Rewrite Temporal.ZonedDateTime.p.toLocaleString tests
In https://github.com/tc39/proposal-temporal/pull/2522 which reached
consensus at the March 2023 TC39 meeting, the functionality of
Temporal.ZonedDateTime.p.toLocaleString was changed substantially, to not
directly pass the ZonedDateTime to any Intl.DateTimeFormat methods. This
adds rewrites of all existing tests for toLocaleString, as well as a few
tests to verify that Intl.DateTimeFormat methods no longer support
Temporal.ZonedDateTime arguments.

As we are rewriting the tests anyway, this also ports all of the
Temporal.ZonedDateTime.p.toLocaleString tests that were in staging, to the
correct format for the main tree.
2023-04-11 11:52:40 +02:00
Guillaume Emont da56f5e2b2 Temporal: updates tests for balancing ordering change in Temporal.Duration.prototype.round
Fixes some tests which are observing side effects of round().
2023-04-10 12:50:11 -07:00
Philip Chimento 6d0978de60 Tweak test descriptions: "Intl time zones" → "IANA time zones"
Suggestion from Justin Grant's code review.
2023-04-10 08:36:08 -07:00
Philip Chimento 33865c5339 Validate required methods of Temporal Calendar protocol
Checking whether an object implements the Calendar protocol is now done by
means of HasProperty operations for each of the required methods unless
the object already has the Calendar brand.

Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00
Philip Chimento bc979c51a5 Remove support for nested Temporal calendar property bags
Previously, "nested" calendar property bags were unwrapped up to one
level. That is, this object:
{
  calendar: {
     // ...Temporal.Calendar methods
  }
}
would not be considered to implement the Calendar protocol, but would have
its calendar property used instead, if it were passed to an API that
required a Calendar protocol object.

These nested property bags are no longer supported. Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00
Philip Chimento 24def913ec Remove support for nested Temporal time zone property bags
Previously, "nested" time zone property bags were unwrapped up to one
level. That is, this object:
{
  timeZone: {
     // ...Temporal.TimeZone methods
  }
}
would not be considered to implement the TimeZone protocol, but would have
its timeZone property used instead, if it were passed to an API that
required a TimeZone protocol object.

These nested property bags are no longer supported. Discussion:
https://github.com/tc39/proposal-temporal/issues/2104#issuecomment-1409549753

Corresponding normative PR:
https://github.com/tc39/proposal-temporal/pull/2485
2023-04-10 08:36:08 -07:00
Philip Chimento 960070549b Store strings or objects in Temporal.ZonedDateTime [[TimeZone]] slot
Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento f2871840b8 Replace Temporal.ZonedDateTime.timeZone getter with new API
This is the replacement of the old API with the new API, .timeZoneId and
.getTimeZone(). Semantics will be corrected in the following commit.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento aee3a937dc Change Temporal.Calendar compare semantics to use .id
Compare semantics for custom calendars that _don't_ extend
Temporal.Calendar (and therefore don't have the internal slot) use the
value of the .id property, instead of calling toString().

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento 41ffc678b0 Store strings or objects in Temporal objects' [[Calendar]] slot
In several tests involving custom calendars, we need to change the
implementation of dateFromFields/monthDayFromFields/yearMonthFromFields so
that the returned object gets the receiver as its calendar after chaining
up to the builtin implementation.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento a1bf99771c Replace Temporal objects' .calendar getters with .calendarId/.getCalendar
This is the replacement of the old API with the new API. Semantics will be
corrected in the following commit.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Philip Chimento 27d7cdad4e Replace Temporal.Now.timeZone → Temporal.Now.timeZoneId
Now.timeZoneId() returns a string so that it can be used to construct
objects that have the builtin time zone behaviour.

Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
2023-04-07 11:43:31 -07:00
Frank Tang beb4f26eb4 Remove unit of ":" in "digital" style. 2023-04-05 16:39:20 +02:00
Frank Tang 4fda9c4c01 Split DurationFormat style tests
For better parallization and reporting
2023-04-05 16:39:20 +02:00
Justin Grant daefac0814 Add test to validate fix to proposal-temporal#2537
The Temporal polyfill had a math bug in Calendar.p.dateUntil where
non-ISO calendars would unexpectedly throw when calculating
the number of years between two dates where the year were different,
the month codes were different, but the months were the same because
the earlier date's month was after a leap month.

This test validates the fix to this bug.
2023-04-03 17:27:34 -07:00