diff --git a/src/stores/mixin.ts b/src/stores/mixin.ts index e86afb1be..71fad33cd 100644 --- a/src/stores/mixin.ts +++ b/src/stores/mixin.ts @@ -304,6 +304,22 @@ export const useCounterMixin = defineStore("mixin", () => { } } + function convertDate(date: string) { + if (date != null && date.length == 10) { + const srcDate = date.split("/"); + const dateVal = + Number(srcDate[2]) - 543 + "-" + srcDate[1] + "-" + srcDate[0]; + + if (moment(dateVal).isValid()) { + return dateVal; + } else { + return "" + } + } else { + return ""; + } + } + function appendLeadingZeroes(n: number) { if (n <= 9) return "0" + n; return n; @@ -956,5 +972,6 @@ export const useCounterMixin = defineStore("mixin", () => { dialogRemove, dialogMessageNotify, fails, + convertDate, }; });