@docusaurus/plugin-content-blog 0.0.0-4843 → 0.0.0-4844
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 +3 -2
- package/package.json +9 -9
- package/src/blogUtils.ts +11 -2
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-
|
|
3
|
+
"version": "0.0.0-4844",
|
|
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-
|
|
22
|
-
"@docusaurus/logger": "0.0.0-
|
|
23
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
24
|
-
"@docusaurus/utils": "0.0.0-
|
|
25
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
26
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
21
|
+
"@docusaurus/core": "0.0.0-4844",
|
|
22
|
+
"@docusaurus/logger": "0.0.0-4844",
|
|
23
|
+
"@docusaurus/mdx-loader": "0.0.0-4844",
|
|
24
|
+
"@docusaurus/utils": "0.0.0-4844",
|
|
25
|
+
"@docusaurus/utils-common": "0.0.0-4844",
|
|
26
|
+
"@docusaurus/utils-validation": "0.0.0-4844",
|
|
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-
|
|
38
|
+
"@docusaurus/types": "0.0.0-4844",
|
|
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": "
|
|
48
|
+
"gitHead": "e0f8d5729166419088bbfd857d12d063c7a53a1e"
|
|
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(
|
|
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(
|
|
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 ?? '';
|