ปรับปฏิทินทะเบียนประวัติ ส่วนการเพิ่มข้อมูลและแก้ไขวันเกิด
This commit is contained in:
parent
cba0f206c2
commit
b5b3ff2ea5
3 changed files with 122 additions and 44 deletions
|
|
@ -304,21 +304,44 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
}
|
||||
}
|
||||
|
||||
function convertDate(date: string) {
|
||||
const convertDate = (date: string) => {
|
||||
if (date != null && date.length == 10) {
|
||||
const srcDate = date.split("/");
|
||||
const srcDate = date.toString().split("/");
|
||||
const dateVal =
|
||||
Number(srcDate[2]) - 543 + "-" + srcDate[1] + "-" + srcDate[0];
|
||||
const check = moment(dateVal).isValid();
|
||||
|
||||
if (moment(dateVal).isValid()) {
|
||||
return dateVal;
|
||||
if (check) {
|
||||
return {
|
||||
isValid: check,
|
||||
value: dateVal,
|
||||
};
|
||||
} else {
|
||||
return ""
|
||||
return {
|
||||
isValid: check,
|
||||
value: "",
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
return {
|
||||
isValid: false,
|
||||
value: "",
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const convertDateDisplay = (dateVal: Date) => {
|
||||
const date = new Date(dateVal);
|
||||
let dstYear = date.getFullYear() + 543;
|
||||
let dstMonth = date.getMonth() + 1;
|
||||
return (
|
||||
date.getDate().toString().padStart(2, "0") +
|
||||
"/" +
|
||||
dstMonth.toString().padStart(2, "0") +
|
||||
"/" +
|
||||
dstYear
|
||||
);
|
||||
};
|
||||
|
||||
function appendLeadingZeroes(n: number) {
|
||||
if (n <= 9) return "0" + n;
|
||||
|
|
@ -973,5 +996,6 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
dialogMessageNotify,
|
||||
fails,
|
||||
convertDate,
|
||||
convertDateDisplay,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue