feat: allow setting calendar for i18n date formatting (#6430)

* feat: allow setting calendar for i18n date formatting

* fix TS

* add test
This commit is contained in:
Joshua Chen 2022-04-08 22:34:34 +08:00 committed by GitHub
parent 3e110054d7
commit 7941a46be3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 54 additions and 12 deletions

View file

@ -254,9 +254,9 @@ function doProcessDocMetadata({
lastUpdatedBy: lastUpdate.lastUpdatedBy,
lastUpdatedAt: lastUpdate.lastUpdatedAt,
formattedLastUpdatedAt: lastUpdate.lastUpdatedAt
? new Intl.DateTimeFormat(i18n.currentLocale).format(
lastUpdate.lastUpdatedAt * 1000,
)
? new Intl.DateTimeFormat(i18n.currentLocale, {
calendar: i18n.localeConfigs[i18n.currentLocale]!.calendar,
}).format(lastUpdate.lastUpdatedAt * 1000)
: undefined,
sidebarPosition,
frontMatter,