Intl polyfill for date formatting

This commit is contained in:
DarkCat09 2023-07-31 11:50:27 +04:00
parent 11f5ed6542
commit 23ac4c36b4
3 changed files with 16 additions and 0 deletions

11
package-lock.json generated
View file

@ -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",

View file

@ -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",

View file

@ -22,6 +22,10 @@ const {
} = Astro.props;
const locale = 'ru-RU';
if (!Intl.DateTimeFormat.supportedLocalesOf(locale)) {
Intl.DateTimeFormat = require('intl').DateTimeFormat;
}
---
<header>