From 30a22f785acc4f48768d57a6207530a636c6f041 Mon Sep 17 00:00:00 2001 From: Miykaelxxm Date: Wed, 2 Mar 2022 15:12:15 +0800 Subject: [PATCH] fix time format --- docs/.vuepress/config.js | 14 +++++++++++++- package.json | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index f7bdba1..08d49af 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -79,7 +79,19 @@ module.exports = { hostname: "https://dev-cloud.gitcode.host/spring/", // 排除无实际内容的页面 exclude: ["/404.html"] - }] + }], + [ + '@vuepress/last-updated', + { + transformer: (timestamp, lang) => { + //return (new Date(timestamp)).toUTCString() 或者用下面这段 + // 不要忘了安装 moment + const moment = require('moment') + moment.locale(lang) + return moment(timestamp).toString() + } + } + ] ], themeConfig: { repo: "https://gitcode.net/dev-cloud/spring", diff --git a/package.json b/package.json index 365678b..697b42c 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "vuepress-plugin-autometa": "^0.1.13" }, "dependencies": { + "moment": "^2.29.1", "vuepress-plugin-sitemap": "^2.3.1" } } -- GitLab