Clear and concise description of the problem
I'm testing out using Temporal instead of Date, and one of the pain points I found is vi.setSystemTime only accepting number | Date.
Suggested solution
Add Temporal as an option to functions that accept Date. The one I encountered was vi.setSystemTime
Alternative
As a workaround, you can convert a PlainDate[Time] to a ZonedDateTime or Instant and get the epoch time from that:
vi.setSystemTime(
Temporal.PlainDateTime.from("2022-02-02 12:00").toZonedDateTime("utc")
.epochMilliseconds,
)
Additional context
Some Temporal support was added in #8007 but that could be achieved without having to use the Temporal global, which I think this feature would require.
For example, (I believe) to support PlainDate in vi.setSystemTime one would have to convert it to a ZonedDatetime to get .epochMilliseconds, which might require using Temporal.Now.timeZoneId() unless you would default to "UTC".
// or "UTC"?
plainDate.toZonedDateTime(Temporal.Now.timeZoneId()).epochMilliseconds
To support this one would probably have to use temporal-polyfill in some way until V8 implements Temporal (nodejs/node#57127 (comment), nodejs/node#57128).
Validations
Clear and concise description of the problem
I'm testing out using Temporal instead of Date, and one of the pain points I found is
vi.setSystemTimeonly acceptingnumber | Date.Suggested solution
Add Temporal as an option to functions that accept
Date. The one I encountered wasvi.setSystemTimeAlternative
As a workaround, you can convert a PlainDate[Time] to a ZonedDateTime or Instant and get the epoch time from that:
Additional context
Some Temporal support was added in #8007 but that could be achieved without having to use the Temporal global, which I think this feature would require.
For example, (I believe) to support
PlainDateinvi.setSystemTimeone would have to convert it to aZonedDatetimeto get.epochMilliseconds, which might require usingTemporal.Now.timeZoneId()unless you would default to"UTC".To support this one would probably have to use
temporal-polyfillin some way until V8 implements Temporal (nodejs/node#57127 (comment), nodejs/node#57128).Validations