refactor(convertDateToAPI): parsedDate new Date
This commit is contained in:
parent
780a815a24
commit
9eaa28711d
1 changed files with 9 additions and 1 deletions
|
|
@ -1252,7 +1252,15 @@ export const useCounterMixin = defineStore("mixin", () => {
|
|||
|
||||
// กรณีมีเฉพาะ date
|
||||
function convertDateToAPI(date: Date | null) {
|
||||
return date ? format(date, "yyyy-MM-dd") : null;
|
||||
if (!date) return null;
|
||||
|
||||
const parsedDate = new Date(date);
|
||||
|
||||
if (parsedDate) {
|
||||
return format(parsedDate, "yyyy-MM-dd");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// กรณี datetime
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue