mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 14:06:59 +02:00
fix(v2): always use UTC when dealing with blog dates (#4983)
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
parent
59f78f9084
commit
80b6d9728e
1 changed files with 3 additions and 1 deletions
|
@ -172,7 +172,8 @@ export async function generateBlogPosts(
|
|||
|
||||
if (dateFilenameMatch) {
|
||||
const [, dateString, name] = dateFilenameMatch;
|
||||
date = new Date(dateString);
|
||||
// Always treat dates as UTC by adding the `Z`
|
||||
date = new Date(`${dateString}Z`);
|
||||
linkName = name;
|
||||
}
|
||||
|
||||
|
@ -187,6 +188,7 @@ export async function generateBlogPosts(
|
|||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
timeZone: 'UTC',
|
||||
}).format(date);
|
||||
|
||||
const title = frontMatter.title ?? contentTitle ?? linkName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue