Skip to content

Conversation

nekevss
Copy link
Member

@nekevss nekevss commented Sep 26, 2025

This is related to work on #1804

It changes the following:

  • Implements a DynamicTimeZoneProvider.
  • Adds a method for setting a custom TimeZoneProvider on ContextBuilder.

This is related to the general API, so please feel free to let me know if you think this is the wrong approach.

Assuming we're happy with the result of this PR and its merged, I would be fine removing Temporal from the experimental feature flags for the next release. We still need to figure out a good way to make reading the host system time zone accessible, but that's still an odd aspect of the specification itself.

@nekevss nekevss added the API label Sep 26, 2025
@nekevss nekevss requested a review from a team September 26, 2025 22:19
Copy link

Test262 conformance changes

Test result main count PR count difference
Total 50,595 50,595 0
Passed 47,567 47,620 +53
Ignored 2,122 2,056 -66
Failed 906 919 +13
Panics 0 0 0
Conformance 94.02% 94.12% +0.10%
Fixed tests (53):
test/staging/upsert/WeakMap/getOrInsertComputed/does-not-have-weakmapdata-internal-slot-object.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/does-not-have-weakmapdata-internal-slot-array.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/this-not-object-throw.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/throw-if-key-cannot-be-held-weakly.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/not-a-function-callbackfn-throws.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/does-not-have-weakmapdata-internal-slot-map.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/name.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/does-not-evaluate-callbackfn-if-key-present.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js (previously Ignored)
test/staging/upsert/WeakMap/getOrInsertComputed/does-not-have-weakmapdata-internal-slot-set.js (previously Ignored)
test/staging/sm/Temporal/ZonedDateTime/zones-and-links.js (previously Failed)
test/built-ins/Map/prototype/getOrInsert/getOrInsert.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/this-not-object-throw.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/append-value-if-key-is-not-present-different-key-types.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/length.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/returns-value-if-key-is-not-present-different-key-types.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/not-a-constructor.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/returns-value-if-key-is-present-different-key-types.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/does-not-have-mapdata-internal-slot-set.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/append-new-values-normalizes-zero-key.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/name.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/does-not-have-mapdata-internal-slot.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/append-new-values.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/does-not-have-mapdata-internal-slot-weakmap.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsert/returns-value-normalized-zero-key.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/check-state-after-callback-fn-throws.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/this-not-object-throw.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/append-value-if-key-is-not-present-different-key-types.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/canonical-key-passed-to-callback.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/not-a-function-callbackfn-throws.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/returns-value-if-key-is-not-present-different-key-types.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/callbackfn-throws.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/not-a-constructor.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/returns-value-if-key-is-present-different-key-types.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/does-not-have-mapdata-internal-slot-set.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/append-new-values-normalizes-zero-key.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/check-callback-fn-args.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/getOrInsertComputed.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/does-not-evaluate-callbackfn-if-key-present.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/append-new-values.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/overwrites-mutation-from-callbackfn.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/does-not-have-mapdata-internal-slot-weakmap.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/different-types-function-callbackfn-does-not-throw.js (previously Ignored)
test/built-ins/Map/prototype/getOrInsertComputed/returns-value-normalized-zero-key.js (previously Ignored)
test/built-ins/WeakMap/prototype/getOrInsert/does-not-have-weakmapdata-internal-slot-object.js (previously Ignored)
test/built-ins/WeakMap/prototype/getOrInsert/does-not-have-weakmapdata-internal-slot-array.js (previously Ignored)
test/built-ins/WeakMap/prototype/getOrInsert/this-not-object-throw.js (previously Ignored)
test/built-ins/WeakMap/prototype/getOrInsert/throw-if-key-cannot-be-held-weakly.js (previously Ignored)
test/built-ins/WeakMap/prototype/getOrInsert/does-not-have-weakmapdata-internal-slot-map.js (previously Ignored)
test/built-ins/WeakMap/prototype/getOrInsert/name.js (previously Ignored)
test/built-ins/WeakMap/prototype/getOrInsert/does-not-have-weakmapdata-internal-slot-weakmap-prototype.js (previously Ignored)
test/built-ins/WeakMap/prototype/getOrInsert/does-not-have-weakmapdata-internal-slot-set.js (previously Ignored)
test/intl402/Temporal/PlainYearMonth/prototype/with/non-iso-calendar-fields.js (previously Failed)

@nekevss
Copy link
Member Author

nekevss commented Sep 26, 2025

NOTE: the tests are not from this PR, but the upsert PR

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Looks good to me! :)

#[cfg(feature = "temporal")]
pub(crate) fn tz_provider(&self) -> &impl TimeZoneProvider {
&self.tz_provider
pub(crate) fn timezone_provider(&self) -> &impl TimeZoneProvider {
Copy link
Member

@jedel1043 jedel1043 Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expose this as &dyn TimeZoneProvider instead, which avoids the additional generic (impl)

}
}

/// The `DynamicTimeZoneProvider` is a wrapper type that allows users
Copy link
Member

@jedel1043 jedel1043 Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use Box<dyn TimeZoneProvider> directly instead? We don't need a wrapper in this case, since the provider is only accessible within the crate

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking nice! Though, I have some suggestions.

Also, it seems like we expose this as the timezone_provider, but the trait is called TimeZoneProvider, so it might be better to expose it as the time_zone_provider?

@jedel1043
Copy link
Member

Probably blocked on boa-dev/temporal#599

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants