website: fix footer timezone bug (#127)

This commit is contained in:
mofelee 2022-11-18 14:39:30 +08:00 committed by GitHub
parent 3846b515b5
commit e060d26815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,10 @@ import formatter from '@uiw/formatter';
export function footer(options = {}) { export function footer(options = {}) {
let footerText = '© 2022 Kenny Wang.'; let footerText = '© 2022 Kenny Wang.';
if (options.isHome) { if (options.isHome) {
footerText += ` Updated on ${formatter('YYYY/MM/DD HH:mm:ss', new Date())}`; const now = new Date();
const utc = now.getTime() + now.getTimezoneOffset() * 60000;
const cst = new Date(utc + 3600000 * 8);
footerText += ` Updated on ${formatter('YYYY/MM/DD HH:mm:ss', cst)}`;
} }
return { return {
type: 'element', type: 'element',