diff --git a/packages/@mantine/dates/src/utils/to-date-string/to-date-string.ts b/packages/@mantine/dates/src/utils/to-date-string/to-date-string.ts index ca3b2dc5b62..5e82a3a0fb0 100644 --- a/packages/@mantine/dates/src/utils/to-date-string/to-date-string.ts +++ b/packages/@mantine/dates/src/utils/to-date-string/to-date-string.ts @@ -4,11 +4,11 @@ import { DateStringValue } from '../../types'; export function toDateString( value: string | number | Date | Dayjs | undefined | null ): DateStringValue | undefined | null { - return value == null ? value : dayjs(value).format('YYYY-MM-DD'); + return value == null || value === '' ? value : dayjs(value).format('YYYY-MM-DD'); } export function toDateTimeString( value: string | number | Date | Dayjs | undefined | null ): DateStringValue | undefined | null { - return value == null ? value : dayjs(value).format('YYYY-MM-DD HH:mm:ss'); + return value == null || value === '' ? value : dayjs(value).format('YYYY-MM-DD HH:mm:ss'); }