fix(admin-ui): datetime поля внутри schema теряли время — теперь DateTimeField
Поля с format=date-time в schema (например orbit.epoch у spacecraft) рендерились через DatePicker и форс-сетили T00:00:00Z. Теперь та же DateTimeField (DatePicker + time input) что и для validFrom/validTo. format=date по-прежнему чистый DatePicker без времени.
This commit is contained in:
@@ -413,6 +413,22 @@ const FieldBody = ({
|
||||
|
||||
if (isDateFormat(schema)) {
|
||||
const isDateTime = schema.format === 'date-time'
|
||||
if (isDateTime) {
|
||||
return (
|
||||
<Controller
|
||||
control={control}
|
||||
name={`data.${fieldKey}` as `data.${string}`}
|
||||
render={({ field }) => (
|
||||
<DateTimeField
|
||||
label={label}
|
||||
value={field.value as string | undefined}
|
||||
defaultTime="00:00"
|
||||
onChange={(iso) => field.onChange(iso || undefined)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<Controller
|
||||
control={control}
|
||||
@@ -424,9 +440,7 @@ const FieldBody = ({
|
||||
hint={schema.description}
|
||||
error={errorMsg}
|
||||
value={parseFormDate(field.value)}
|
||||
onChange={(d) =>
|
||||
field.onChange(d ? (isDateTime ? formatIsoDateTime(d) : formatIsoDate(d)) : undefined)
|
||||
}
|
||||
onChange={(d) => field.onChange(d ? formatIsoDate(d) : undefined)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user