Skip to content

Instantly share code, notes, and snippets.

@wmakeev
Last active September 2, 2024 03:40
Show Gist options
  • Save wmakeev/96ee0551c4b8fb6f4937c9bb26db9b23 to your computer and use it in GitHub Desktop.
Save wmakeev/96ee0551c4b8fb6f4937c9bb26db9b23 to your computer and use it in GitHub Desktop.
[Intl format] #date #number #money #format #intl #locale
// 02.09.2024
new Intl.DateTimeFormat("ru", {
dateStyle: "short",
timeZone: "Europe/Moscow",
}).format(new Date());
// 02.09.2024, 05:59
new Intl.DateTimeFormat("ru", {
dateStyle: "short",
timeStyle: "short",
timeZone: "Europe/Moscow",
}).format(new Date());
// 2 сент. 2024 г.
new Intl.DateTimeFormat("ru", {
dateStyle: "medium",
timeZone: "Europe/Moscow",
}).format(new Date());
// 2 сент. 2024 г., 06:06:33
new Intl.DateTimeFormat("ru", {
dateStyle: "medium",
timeStyle: "medium",
timeZone: "Europe/Moscow",
}).format(new Date());
// 2 сентября 2024 г. в 06:13:40 GMT+3
new Intl.DateTimeFormat("ru", {
dateStyle: "long",
timeStyle: "long",
timeZone: "Europe/Moscow",
}).format(new Date());
// понедельник, 2 сентября 2024 г. в 06:15:03 Москва, стандартное время
new Intl.DateTimeFormat("ru", {
dateStyle: "full",
timeStyle: "full",
timeZone: "Europe/Moscow",
}).format(new Date());
// 123 456,79 ₽
new Intl.NumberFormat("ru", { style: "currency", currency: "RUB" }).format(
123456.789
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment