From 23ac4c36b48b94e2109242bb7054fb768bd4841f Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 31 Jul 2023 11:50:27 +0400 Subject: [PATCH] Intl polyfill for date formatting --- package-lock.json | 11 +++++++++++ package.json | 1 + src/components/Article.astro | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/package-lock.json b/package-lock.json index 3791253..22a3289 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "dependencies": { "astro": "^2.9.0", "astro-compress": "^1.1.50", + "intl": "^1.2.5", "less": "^4.1.3", "reading-time": "^1.5.0", "rehype-autolink-headings": "^6.1.1", @@ -3187,6 +3188,11 @@ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, + "node_modules/intl": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/intl/-/intl-1.2.5.tgz", + "integrity": "sha512-rK0KcPHeBFBcqsErKSpvZnrOmWOj+EmDkyJ57e90YWaQNqbcivcqmKDlHEeNprDWOsKzPsh1BfSpPQdDvclHVw==" + }, "node_modules/is-arrayish": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", @@ -8905,6 +8911,11 @@ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==" }, + "intl": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/intl/-/intl-1.2.5.tgz", + "integrity": "sha512-rK0KcPHeBFBcqsErKSpvZnrOmWOj+EmDkyJ57e90YWaQNqbcivcqmKDlHEeNprDWOsKzPsh1BfSpPQdDvclHVw==" + }, "is-arrayish": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", diff --git a/package.json b/package.json index afb6380..a933793 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "dependencies": { "astro": "^2.9.0", "astro-compress": "^1.1.50", + "intl": "^1.2.5", "less": "^4.1.3", "reading-time": "^1.5.0", "rehype-autolink-headings": "^6.1.1", diff --git a/src/components/Article.astro b/src/components/Article.astro index 3afbe25..afa1da3 100644 --- a/src/components/Article.astro +++ b/src/components/Article.astro @@ -22,6 +22,10 @@ const { } = Astro.props; const locale = 'ru-RU'; + +if (!Intl.DateTimeFormat.supportedLocalesOf(locale)) { + Intl.DateTimeFormat = require('intl').DateTimeFormat; +} ---