remove the moment.js dependency

This commit is contained in:
njost
2024-03-15 23:21:13 +00:00
committed by ekresse
parent 7bb0af18c1
commit caefe2e475
3 changed files with 15 additions and 36 deletions

View File

@ -30,7 +30,6 @@
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-vue": "^9.20.0",
"moment-timezone": "^0.5.44",
"prettier": "3.2.1",
"sass": "^1.69.7",
"sass-loader": "^13.3.3",
@ -3173,27 +3172,6 @@
"ufo": "^1.3.2"
}
},
"node_modules/moment": {
"version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
"dev": true,
"engines": {
"node": "*"
}
},
"node_modules/moment-timezone": {
"version": "0.5.44",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.44.tgz",
"integrity": "sha512-nv3YpzI/8lkQn0U6RkLd+f0W/zy/JnoR5/EyPz/dNkPTBjA2jNLCVxaiQ8QpeLymhSZvX0wCL5s27NQWdOPwAw==",
"dev": true,
"dependencies": {
"moment": "^2.29.4"
},
"engines": {
"node": "*"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",

View File

@ -35,7 +35,6 @@
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-vue": "^9.20.0",
"moment-timezone": "^0.5.44",
"prettier": "3.2.1",
"sass": "^1.69.7",
"sass-loader": "^13.3.3",

View File

@ -2,7 +2,6 @@
import { Ref, inject } from "vue";
import { Module } from "../model/module.ts";
import { Event } from "../model/event.ts";
import moment from "moment-timezone";
import { useI18n } from "vue-i18n";
const { t } = useI18n({ useScope: "global" });
@ -12,24 +11,27 @@ const dialogRef = inject("dialogRef") as any;
const module = dialogRef.value.data.module as Module;
const mobilePage = inject("mobilePage") as Ref<boolean>;
// formats 2023-10-26 11:45:00.000Z to DD-MM-YYYY HH:MM
function formatTimestamp(timestampString: string): string {
// Den übergebenen Zeitstempel in ein Moment-Objekt umwandeln
const timestamp = moment(timestampString);
// Die Zeitzone auf "Europe/Berlin" setzen
const berlinTime = timestamp.tz("Europe/Berlin");
// Das gewünschte Format für die Ausgabe festlegen
return berlinTime.format("DD.MM.YYYY HH:mm");
}
function sortModuleEventsByStart(events: Event[]) {
return events.sort((a, b) => {
return a.start.localeCompare(b.start);
});
}
const timeFormater = new Intl.DateTimeFormat("de-DE", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
hour12: false,
timeZone: "Europe/Berlin",
});
// formats 2023-10-26 11:45:00.000Z to DD-MM-YYYY HH:MM
function formatTimestamp(timestampString: string) {
return timeFormater.format(new Date(timestampString)).replace(",", "");
}
function formatWeekday(weekday: string) {
const template = "moduleInformation.weekday." + weekday;
const translation = t(template);