Skip to content

Instantly share code, notes, and snippets.

@johanbrook
Created March 1, 2024 02:21
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 johanbrook/456bb13fee1a773f2cc9fff81db16b47 to your computer and use it in GitHub Desktop.
Save johanbrook/456bb13fee1a773f2cc9fff81db16b47 to your computer and use it in GitHub Desktop.
// Run with:
// $ TZ="Europe/London" deno run --unstable-temporal
const DATE_FORMAT: Intl.DateTimeFormatOptions = {
month: 'long',
year: 'numeric',
day: 'numeric',
hour: '2-digit',
hour12: false,
minute: '2-digit',
second: '2-digit',
};
let date = Temporal.Now.zonedDateTimeISO(Temporal.TimeZone.from('Asia/Bangkok'));
const formatter = new Intl.DateTimeFormat(undefined, {
...DATE_FORMAT,
timeZone: date.timeZone // <- Le sigh
});
console.log(formatter.format(date));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment