fix(v2): always use UTC when dealing with blog dates (#4983)

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
Joshua Chen 2021-06-17 00:59:44 +08:00 committed by GitHub
parent 59f78f9084
commit 80b6d9728e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;