@docusaurus/plugin-content-blog 0.0.0-4843 → 0.0.0-4847

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/blogUtils.js CHANGED
@@ -85,13 +85,14 @@ function parseBlogFileName(blogSourceRelative) {
85
85
  return { date: undefined, text, slug };
86
86
  }
87
87
  exports.parseBlogFileName = parseBlogFileName;
88
- function formatBlogPostDate(locale, date) {
88
+ function formatBlogPostDate(locale, date, calendar) {
89
89
  try {
90
90
  return new Intl.DateTimeFormat(locale, {
91
91
  day: 'numeric',
92
92
  month: 'long',
93
93
  year: 'numeric',
94
94
  timeZone: 'UTC',
95
+ calendar,
95
96
  }).format(date);
96
97
  }
97
98
  catch (err) {
@@ -157,7 +158,7 @@ async function processBlogSourceFile(blogSourceRelative, contentPaths, context,
157
158
  }
158
159
  }
159
160
  const date = await getDate();
160
- const formattedDate = formatBlogPostDate(i18n.currentLocale, date);
161
+ const formattedDate = formatBlogPostDate(i18n.currentLocale, date, i18n.localeConfigs[i18n.currentLocale].calendar);
161
162
  const title = frontMatter.title ?? contentTitle ?? parsedBlogFileName.text;
162
163
  const description = frontMatter.description ?? excerpt ?? '';
163
164
  const slug = frontMatter.slug || parsedBlogFileName.slug;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/plugin-content-blog",
3
- "version": "0.0.0-4843",
3
+ "version": "0.0.0-4847",
4
4
  "description": "Blog plugin for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/plugin-content-blog.d.ts",
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@docusaurus/core": "0.0.0-4843",
22
- "@docusaurus/logger": "0.0.0-4843",
23
- "@docusaurus/mdx-loader": "0.0.0-4843",
24
- "@docusaurus/utils": "0.0.0-4843",
25
- "@docusaurus/utils-common": "0.0.0-4843",
26
- "@docusaurus/utils-validation": "0.0.0-4843",
21
+ "@docusaurus/core": "0.0.0-4847",
22
+ "@docusaurus/logger": "0.0.0-4847",
23
+ "@docusaurus/mdx-loader": "0.0.0-4847",
24
+ "@docusaurus/utils": "0.0.0-4847",
25
+ "@docusaurus/utils-common": "0.0.0-4847",
26
+ "@docusaurus/utils-validation": "0.0.0-4847",
27
27
  "cheerio": "^1.0.0-rc.10",
28
28
  "feed": "^4.2.2",
29
29
  "fs-extra": "^10.0.1",
@@ -35,7 +35,7 @@
35
35
  "webpack": "^5.70.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@docusaurus/types": "0.0.0-4843",
38
+ "@docusaurus/types": "0.0.0-4847",
39
39
  "escape-string-regexp": "^4.0.0"
40
40
  },
41
41
  "peerDependencies": {
@@ -45,5 +45,5 @@
45
45
  "engines": {
46
46
  "node": ">=14"
47
47
  },
48
- "gitHead": "969ea1e03a0bb2c1ec75e91b3175bef0746d9b22"
48
+ "gitHead": "7002c64be10021e6abfd3c9b87ce40a7c74550de"
49
49
  }
package/src/blogUtils.ts CHANGED
@@ -151,13 +151,18 @@ export function parseBlogFileName(
151
151
  return {date: undefined, text, slug};
152
152
  }
153
153
 
154
- function formatBlogPostDate(locale: string, date: Date): string {
154
+ function formatBlogPostDate(
155
+ locale: string,
156
+ date: Date,
157
+ calendar: string,
158
+ ): string {
155
159
  try {
156
160
  return new Intl.DateTimeFormat(locale, {
157
161
  day: 'numeric',
158
162
  month: 'long',
159
163
  year: 'numeric',
160
164
  timeZone: 'UTC',
165
+ calendar,
161
166
  }).format(date);
162
167
  } catch (err) {
163
168
  logger.error`Can't format blog post date "${String(date)}"`;
@@ -253,7 +258,11 @@ async function processBlogSourceFile(
253
258
  }
254
259
 
255
260
  const date = await getDate();
256
- const formattedDate = formatBlogPostDate(i18n.currentLocale, date);
261
+ const formattedDate = formatBlogPostDate(
262
+ i18n.currentLocale,
263
+ date,
264
+ i18n.localeConfigs[i18n.currentLocale]!.calendar,
265
+ );
257
266
 
258
267
  const title = frontMatter.title ?? contentTitle ?? parsedBlogFileName.text;
259
268
  const description = frontMatter.description ?? excerpt ?? '';