From 30379bfe2592011b2374f501cc3d8a3df20194e2 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 29 Aug 2024 13:28:18 +0700 Subject: [PATCH] fix: date picker input format --- src/utils/datetime.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils/datetime.ts b/src/utils/datetime.ts index 8bb97097..7cea1b5f 100644 --- a/src/utils/datetime.ts +++ b/src/utils/datetime.ts @@ -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;