diff --git a/package-lock.json b/package-lock.json index df3e38f..a00998a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "core-js": "^3.8.3", "echarts": "^5.4.2", + "moment": "^2.29.4", "normalize.css": "^8.0.1", "vue": "^2.6.14", "vue-router": "^3.5.1", @@ -7011,6 +7012,14 @@ "dev": true, "license": "MIT" }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "engines": { + "node": "*" + } + }, "node_modules/mrmime": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/mrmime/-/mrmime-1.0.1.tgz", @@ -15415,6 +15424,11 @@ "integrity": "sha512-A/78XjoX2EmNvppVWEhM2oGk3x4lLxnkEA4jTbaK97QKSDjkIoOsKQlfylt/d3kKKi596Qy3NP5XrXJ6fZIC9Q==", "dev": true }, + "moment": { + "version": "2.29.4", + "resolved": "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" + }, "mrmime": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/mrmime/-/mrmime-1.0.1.tgz", diff --git a/package.json b/package.json index 57cf67d..0609330 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "dependencies": { "core-js": "^3.8.3", "echarts": "^5.4.2", + "moment": "^2.29.4", "normalize.css": "^8.0.1", "vue": "^2.6.14", "vue-router": "^3.5.1", diff --git a/src/components/boxes/KilnRuntime.vue b/src/components/boxes/KilnRuntime.vue index 7fb9791..48ae70e 100644 --- a/src/components/boxes/KilnRuntime.vue +++ b/src/components/boxes/KilnRuntime.vue @@ -28,7 +28,7 @@ export default { props: {}, data() { return { - time: " 天 时", + time: " 天", }; }, mounted() { @@ -37,12 +37,12 @@ export default { }, methods: { getRuntime() { - const diff = Date.now() - new Date("2023-5-13 10:00:00"); + const diff = Date.now() - new Date("2023-5-7 8:00:00"); const days = parseInt(diff / 1000 / 60 / 60 / 24); const hours = parseInt( (diff - days * 24 * 60 * 60 * 1000) / 1000 / 60 / 60 ); - this.time = `${days}天${hours}时`; + this.time = `${days}天`; }, }, }; diff --git a/src/components/layout/Header.vue b/src/components/layout/Header.vue index 241000a..4bc7292 100644 --- a/src/components/layout/Header.vue +++ b/src/components/layout/Header.vue @@ -8,18 +8,20 @@ - {{ date }} {{ week }} {{ time }} + {{ moment(today).format('YYYY.M.D dddd HH:mm:ss') }}