-
Notifications
You must be signed in to change notification settings - Fork 22
Description
When calling Temporal.Now.zonedDateTimeISO() in a QuickJS environment, the resulting ZonedDateTime object has an incorrect UTC offset (e.g., -16:00) even when the underlying Intl polyfill is correctly configured and provides the correct offset when queried directly.
Example result for Temporal.Now in America/New_York:
2025-07-09T21:40:10.872-16:00[America/New_York]
The following script demonstrates the issue for me:
import '@formatjs/intl-getcanonicallocales/polyfill-force.js'
import '@formatjs/intl-locale/polyfill-force.js'
import '@formatjs/intl-pluralrules/polyfill-force.js'
import '@formatjs/intl-numberformat/polyfill-force.js'
import '@formatjs/intl-numberformat/locale-data/en.js'
import '@formatjs/intl-datetimeformat/polyfill-force.js'
import '@formatjs/intl-datetimeformat/locale-data/en'
import '@formatjs/intl-datetimeformat/add-all-tz.js'
import { Temporal } from 'temporal-polyfill';
globalThis.Temporal = Temporal;
const formatter = new Intl.DateTimeFormat('en-US', {
timeZone: 'America/New_York',
timeZoneName: 'longOffset',
});
const offsetFromIntl = formatter.formatToParts(new Date()).find(part => part.type === 'timeZoneName')?.value;
console.log('Offset from Intl.DateTimeFormat directly:', offsetFromIntl);
const nowInNewYork = Temporal.Now.zonedDateTimeISO("America/New_York");
console.log('Result from Temporal.Now.zonedDateTimeISO:', nowInNewYork.toString());To run this script with QuickJS interpreter we need to bundle it, for example using esbuild:
npx esbuild test.js --bundle --outfile=test.bundle.js --format=iife --platform=neutral --banner:js="globalThis.Intl = {};"
And the run it using qjs:
qjs test.bundle.js
This is the output for me:
Offset from Intl.DateTimeFormat directly: GMT-4
Result from Temporal.Now.zonedDateTimeISO: 2025-07-09T21:40:10.872-16:00[America/New_York]
Note that running the same code using the js-temporal/temporal-polyfill returns the right offset on the same environment:
2025-07-10T08:17:21.062841028-04:00[America/New_York]
I dunno if the problem lies in fullcalendar/temporal-polyfill or the FormatJS polyfills, let me known if I can help in any way to debug the issue.