fix: input date only (birth date for now)

This commit is contained in:
puriphatt 2024-07-16 08:12:01 +00:00
parent 2d8c4d5d6a
commit a92e9ffdc1
2 changed files with 36 additions and 2 deletions

View file

@ -103,3 +103,13 @@ export function disabledAfterToday(date: Date) {
today.setHours(0, 0, 0, 0);
return date > today;
}
export function parseAndFormatDate(value: string | number | undefined) {
if (!value) return;
if (value && value.toString().length === 10) {
const [year, month, day] = value.toString().split('/');
return new Date(`${day}/${month}/${year}`);
}
return;
}