Merge branch 'warunee-dev' into develop

This commit is contained in:
Warunee Tamkoo 2023-09-22 17:33:24 +07:00
commit c0e115cfac

View file

@ -244,13 +244,17 @@ export const useCounterMixin = defineStore("mixin", () => {
}
function dateToISO(date: Date) {
return (
date.getFullYear() +
"-" +
appendLeadingZeroes(date.getMonth() + 1) +
"-" +
appendLeadingZeroes(date.getDate())
);
const isValidDate = Boolean(+date);
if (!isValidDate) return null;
if (isValidDate && date.getFullYear() < 1000) {
return (
date.getFullYear() +
"-" +
appendLeadingZeroes(date.getMonth() + 1) +
"-" +
appendLeadingZeroes(date.getDate())
);
}
}
function appendLeadingZeroes(n: number) {