Skip to content

Instantly share code, notes, and snippets.

@yesley

yesley/intl.js

Created Jan 13, 2021
Embed
What would you like to do?
const date = new Date()
const formatOptions = {
hour12: false,
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
}
const dtVolgograd = new Intl.DateTimeFormat("en-US", {
...formatOptions,
timeZone: "Europe/Volgograd"
}).format(date)
const dtMoscow = new Intl.DateTimeFormat("en-US", {
...formatOptions,
timeZone: "Europe/Moscow"
}).format(date)
console.log(dtVolgograd === dtMoscow) // `true` expected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment