fix: date picker input format

This commit is contained in:
puriphatt 2024-08-29 13:28:18 +07:00
parent 7caf0dfdd9
commit 30379bfe25

View file

@ -119,12 +119,11 @@ export function parseAndFormatDate(
if (value && value.toString().length === 10) {
const [date, month, year] = value.toString().split('/');
if (locale === 'tha') {
const adjustedYear = Number(year) - 543;
return new Date(`${month}/${date}/${adjustedYear}T00:00.000Z`);
return new Date(`${adjustedYear}-${month}-${date}T00:00:00.000Z`);
} else {
return new Date(`${month}/${date}/${year}T00:00.000Z`);
return new Date(`${year}-${month}-${date}T00:00:00.000Z`);
}
}
return null;