mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
Merge pull request #8970 from supabase/fix/safari-datepicker-invalid-date
Fix case where date is null
This commit is contained in:
1 file changed
+4
-2
+4
-2
@@ -177,11 +177,13 @@ const nowDateTimeValue = (format: string) => {
|
||||
}
|
||||
|
||||
const convertPostgresDatetimeToInputDatetime = (format: string, value: string) => {
|
||||
const valueWithSlashes = value.replaceAll('-', '/')
|
||||
if (value) {
|
||||
value = value.includes('-') ? value.replaceAll('-', '/') : value
|
||||
}
|
||||
|
||||
if (!value || value.length == 0) return ''
|
||||
if (TIMESTAMP_TYPES.includes(format)) {
|
||||
return dayjs(valueWithSlashes).format('YYYY-MM-DDTHH:mm:ss')
|
||||
return dayjs(value).format('YYYY-MM-DDTHH:mm:ss')
|
||||
} else if (TIME_TYPES.includes(format)) {
|
||||
const serverTimeFormat = value && value.includes('+') ? 'HH:mm:ssZZ' : 'HH:mm:ss'
|
||||
return dayjs(value, serverTimeFormat).format('HH:mm:ss')
|
||||
|
||||
Reference in new issue
Block a user