Skip to content

Instantly share code, notes, and snippets.

@arshaw
Created April 6, 2024 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arshaw/1ef4bf945d68654b86cef2dd8471c48f to your computer and use it in GitHub Desktop.
Save arshaw/1ef4bf945d68654b86cef2dd8471c48f to your computer and use it in GitHub Desktop.
Ways to avoid BigInt while using Temporal
new Temporal.ZonedDateTime(nano, timeZone, calendar)
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli)
/* */ .toZonedDateTimeISO(timeZone)
/* OR */
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli)
/* */ .toZonedDateTime({ timeZone, calendar })
zonedDateTime.epochMicroseconds
/* instead: */ zonedDateTime.epochMilliseconds
zonedDateTime.epochNanoseconds
/* instead: */ zonedDateTime.epochMilliseconds
new Temporal.Instant(nano)
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli)
Temporal.Instant.fromEpochMicroseconds(micro)
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli)
Temporal.Instant.fromEpochNanoseconds(nano)
/* instead: */ Temporal.Instant.fromEpochMilliseconds(milli)
instant.epochMicroseconds
/* instead: */ instant.epochMilliseconds
instant.epochNanoseconds
/* instead: */ instant.epochMilliseconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment