fix(core): use UTC date methods for slug formatting (#2944)

This commit is contained in:
Shawn Erquhart 2019-12-02 17:03:18 -05:00 committed by GitHub
parent 87b4d0f765
commit d0b32a7a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,12 +7,12 @@ function formatDate(date) {
} }
export const dateParsers = { export const dateParsers = {
year: date => date.getFullYear(), year: date => date.getUTCFullYear(),
month: date => formatDate(date.getMonth() + 1), month: date => formatDate(date.getUTCMonth() + 1),
day: date => formatDate(date.getDate()), day: date => formatDate(date.getUTCDate()),
hour: date => formatDate(date.getHours()), hour: date => formatDate(date.getUTCHours()),
minute: date => formatDate(date.getMinutes()), minute: date => formatDate(date.getUTCMinutes()),
second: date => formatDate(date.getSeconds()), second: date => formatDate(date.getUTCSeconds()),
}; };
export const SLUG_MISSING_REQUIRED_DATE = 'SLUG_MISSING_REQUIRED_DATE'; export const SLUG_MISSING_REQUIRED_DATE = 'SLUG_MISSING_REQUIRED_DATE';