Skip to content

Allow replacing Temporal.Now in the library export - #377

Open
mayankdhingra02 wants to merge 1 commit into
js-temporal:mainfrom
mayankdhingra02:codex/configurable-temporal-now
Open

mayankdhingra02 wants to merge 1 commit into
js-temporal:mainfrom
mayankdhingra02:codex/configurable-temporal-now

Conversation

@mayankdhingra02

Copy link
Copy Markdown

Fixes #363.

The library exports Temporal as an ES module namespace, so a test clock cannot replace Temporal.Now and restore it afterward. The export now preserves the existing properties and gives Now the same writable, non-enumerable, configurable descriptor as native Temporal. The regression test replaces Now, reads the fake clock, and restores the original descriptor.

On Node 26, all 608 Jest tests, lint, type checks, and the valid-strings test passed. I also checked replacement and restoration through both built package entry points. Test262 debug, production, and ES5 runs produced the same results as unchanged main, including the existing intl402/Temporal/ZonedDateTime/links.js failure.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Temporal.Now is non-configurable and cannot be redefined

1 participant