Big Update

This commit is contained in:
2025-03-25 21:48:41 +01:00
parent ec6b611646
commit 18605dfc64
16 changed files with 615 additions and 63 deletions

View File

@@ -0,0 +1,23 @@
const { DateTime } = require("luxon");
class ParseTools {
static parseDateTime(date, format="yyyy-MM-dd") {
return DateTime.fromFormat(date, format, { zone: "Europe/Berlin" });
}
static isFilled(value, returnValOrNull=false) {
const res = value !== "" && value !== "-";
return returnValOrNull ? (res ? value : null) : res;
}
static daysToArray(days, seperator=", ", format="dd.MM.yyyy") {
let res = [];
days.split(seperator).forEach(day => {
if(day === "") return;
res.push(this.parseDateTime(day, format));
});
return res;
}
}
module.exports = ParseTools