mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
Fix invalid date issue if seconds are set to 0 in html input datetime
This commit is contained in:
1 parent
96ece6b4f8
commit
e41246ef0b
2 files changed
+6
-1
No files matched your search
@@ -122,6 +122,7 @@ const RowEditor: FC<Props> = ({
|
||||
|
||||
if (isEmpty(errors)) {
|
||||
updateEditorDirty()
|
||||
|
||||
const payload = isNewRecord
|
||||
? generateRowObjectFromFields(rowFields)
|
||||
: generateUpdateRowPayload(row, rowFields)
|
||||
|
||||
+5
-1
@@ -275,7 +275,11 @@ export const generateRowObjectFromFields = (
|
||||
} else if (field.format === 'bool' && value) {
|
||||
rowObject[field.name] = value === 'true'
|
||||
} else if (DATETIME_TYPES.includes(field.format)) {
|
||||
rowObject[field.name] = convertInputDatetimeToPostgresDatetime(field.format, value)
|
||||
// Seconds are missing if they are set to 0 in the HTML input
|
||||
// Need to format that first, before passing to dayjs
|
||||
const timeSegments = (value || '').split(':')
|
||||
const formattedValue = timeSegments.length === 2 ? `${value}:00` : value
|
||||
rowObject[field.name] = convertInputDatetimeToPostgresDatetime(field.format, formattedValue)
|
||||
} else {
|
||||
rowObject[field.name] = value
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user