diff --git a/web/package.json b/web/package.json index a64d010..db2f389 100644 --- a/web/package.json +++ b/web/package.json @@ -15,6 +15,7 @@ "apexcharts": "^4.3.0", "axios": "^1.7.9", "core-js": "^3.39.0", + "moment": "^2.30.1", "moo": "^0.5.2", "nearley": "^2.20.1", "pinia": "^2.3.0", @@ -22,7 +23,6 @@ "tiny-typed-emitter": "^2.1.0", "vue": "^2.7.14", "vue-apexcharts": "git+https://github.com/apexcharts/vue-apexcharts#c4b6de32b0659a46d610e4f457afb8ede0493fef", - "vue-moment": "^4.1.0", "vue-router": "^3.6.5", "vuetify": "^2.6.14" }, diff --git a/web/src/filters.ts b/web/src/filters.ts index 6a5dfe0..94de39c 100644 --- a/web/src/filters.ts +++ b/web/src/filters.ts @@ -1,4 +1,4 @@ -import vue from "./main"; +import moment from "moment"; export function capitalize(value: string | null) { if (!value) return ""; @@ -13,21 +13,21 @@ export function tagify(id: string, what: "id" | "type" | "name") { } export function formatDuration(seconds: number) { - return vue.$moment.duration(seconds, "seconds").humanize(); + return moment.duration(seconds, "seconds").humanize(); } export function formatDate(time: string | Date | null) { if (time === null) return undefined; - const moment = vue.$moment(time).local(); + const date = moment(time).local(); let format = "HH:mm:ss.SSS"; - if (!moment.isSame(vue.$moment(), "day")) format = `YYYY-MM-DD ${format}`; - return moment.format(format); + if (!date.isSame(moment(), "day")) format = `YYYY-MM-DD ${format}`; + return date.format(format); } export function formatDateLong(time: string | Date | null) { if (time === null) return undefined; - const moment = vue.$moment(time).local(); - return moment.format("YYYY-MM-DD HH:mm:ss.SSS ZZ"); + const date = moment(time).local(); + return date.format("YYYY-MM-DD HH:mm:ss.SSS ZZ"); } export function tagForURI(tagId: string) { diff --git a/web/src/main.ts b/web/src/main.ts index 15126e9..a3e7520 100644 --- a/web/src/main.ts +++ b/web/src/main.ts @@ -5,14 +5,12 @@ import { createPinia, PiniaVuePlugin } from "pinia"; import App from "./App.vue"; import router from "./routes"; import VueApexCharts from "vue-apexcharts"; -import * as VueMoment from "vue-moment"; Vue.config.productionTip = process.env.NODE_ENV == "production"; Vue.use(PiniaVuePlugin); Vue.use(Vuetify); Vue.use(VueApexCharts); -Vue.use(VueMoment); Vue.component("Apexchart", VueApexCharts); diff --git a/web/yarn.lock b/web/yarn.lock index 3af889a..e940af0 100644 --- a/web/yarn.lock +++ b/web/yarn.lock @@ -2095,7 +2095,7 @@ mlly@^1.7.2, mlly@^1.7.3: pkg-types "^1.2.1" ufo "^1.5.4" -moment@>=2.24.0, moment@^2.19.2: +moment@>=2.24.0, moment@^2.30.1: version "2.30.1" resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae" integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how== @@ -3059,13 +3059,6 @@ vue-eslint-parser@^9.3.1, vue-eslint-parser@^9.4.3: lodash "^4.17.21" semver "^7.3.6" -vue-moment@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/vue-moment/-/vue-moment-4.1.0.tgz#092a8ff723a96c6f85a0a8e23ad30f0bf320f3b0" - integrity sha512-Gzisqpg82ItlrUyiD9d0Kfru+JorW2o4mQOH06lEDZNgxci0tv/fua1Hl0bo4DozDV2JK1r52Atn/8QVCu8qQw== - dependencies: - moment "^2.19.2" - vue-router@^3.6.5: version "3.6.5" resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.6.5.tgz#95847d52b9a7e3f1361cb605c8e6441f202afad8"