function convertdate

This commit is contained in:
Warunee Tamkoo 2024-02-12 18:06:23 +07:00
parent 1d6e86c918
commit 07c782950a

View file

@ -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,
};
});