Created
March 1, 2024 02:21
-
-
Save johanbrook/456bb13fee1a773f2cc9fff81db16b47 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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