diff --git a/polyfill/lib/now.mjs b/polyfill/lib/now.mjs index 1c5177fa6..e36c56838 100644 --- a/polyfill/lib/now.mjs +++ b/polyfill/lib/now.mjs @@ -2,7 +2,10 @@ import { ObjectDefineProperty, SymbolToStringTag } from './primordials.mjs'; import * as ES from './ecmascript.mjs'; import { GetIntrinsic } from './intrinsicclass.mjs'; -import { GetSlot, ISO_DATE_TIME } from './slots.mjs'; + +function SystemDateTime(timeZone) { + return ES.GetISODateTimeFor(timeZone, ES.SystemUTCEpochNanoSeconds()); +} const instant = () => { const Instant = GetIntrinsic('%Temporal.Instant%'); @@ -10,7 +13,7 @@ const instant = () => { }; const plainDateTimeISO = (temporalTimeZoneLike = ES.DefaultTimeZone()) => { const timeZone = ES.ToTemporalTimeZoneIdentifier(temporalTimeZoneLike); - const isoDateTime = ES.GetISODateTimeFor(timeZone, ES.SystemUTCEpochNanoSeconds()); + const isoDateTime = SystemDateTime(timeZone); return ES.CreateTemporalDateTime(isoDateTime, 'iso8601'); }; const zonedDateTimeISO = (temporalTimeZoneLike = ES.DefaultTimeZone()) => { @@ -18,10 +21,14 @@ const zonedDateTimeISO = (temporalTimeZoneLike = ES.DefaultTimeZone()) => { return ES.CreateTemporalZonedDateTime(ES.SystemUTCEpochNanoSeconds(), timeZone, 'iso8601'); }; const plainDateISO = (temporalTimeZoneLike = ES.DefaultTimeZone()) => { - return ES.CreateTemporalDate(GetSlot(plainDateTimeISO(temporalTimeZoneLike), ISO_DATE_TIME).isoDate, 'iso8601'); + const timeZone = ES.ToTemporalTimeZoneIdentifier(temporalTimeZoneLike); + const isoDateTime = SystemDateTime(timeZone); + return ES.CreateTemporalDate(isoDateTime.isoDate, 'iso8601'); }; const plainTimeISO = (temporalTimeZoneLike = ES.DefaultTimeZone()) => { - return ES.CreateTemporalTime(GetSlot(plainDateTimeISO(temporalTimeZoneLike), ISO_DATE_TIME).time); + const timeZone = ES.ToTemporalTimeZoneIdentifier(temporalTimeZoneLike); + const isoDateTime = SystemDateTime(timeZone); + return ES.CreateTemporalTime(isoDateTime.time); }; const timeZoneId = () => { return ES.DefaultTimeZone(); diff --git a/spec/temporal.html b/spec/temporal.html index 6abd348f6..737c19c23 100644 --- a/spec/temporal.html +++ b/spec/temporal.html @@ -122,7 +122,8 @@
This function performs the following steps when called:
This function performs the following steps when called:
This function performs the following steps when called: