fix bug dateToISO in mixin
This commit is contained in:
parent
32a68116dc
commit
792ea7ef33
1 changed files with 8 additions and 6 deletions
|
|
@ -244,16 +244,18 @@ export const useCounterMixin = defineStore("mixin", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateToISO(date: Date) {
|
function dateToISO(date: Date) {
|
||||||
const isValidDate = Boolean(+date);
|
if (date != null) {
|
||||||
if (!isValidDate) return null;
|
const srcDate = new Date(date)
|
||||||
if (isValidDate && date.getFullYear() < 1000) {
|
|
||||||
return (
|
return (
|
||||||
date.getFullYear() +
|
srcDate.getFullYear() +
|
||||||
"-" +
|
"-" +
|
||||||
appendLeadingZeroes(date.getMonth() + 1) +
|
appendLeadingZeroes(srcDate.getMonth() + 1) +
|
||||||
"-" +
|
"-" +
|
||||||
appendLeadingZeroes(date.getDate())
|
appendLeadingZeroes(srcDate.getDate())
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue