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:
Zimin A.N.
2026-05-04 03:42:11 +03:00
parent baf76ac6e0
commit 0e12a254c2
@@ -413,6 +413,22 @@ const FieldBody = ({
if (isDateFormat(schema)) { if (isDateFormat(schema)) {
const isDateTime = schema.format === 'date-time' 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 ( return (
<Controller <Controller
control={control} control={control}
@@ -424,9 +440,7 @@ const FieldBody = ({
hint={schema.description} hint={schema.description}
error={errorMsg} error={errorMsg}
value={parseFormDate(field.value)} value={parseFormDate(field.value)}
onChange={(d) => onChange={(d) => field.onChange(d ? formatIsoDate(d) : undefined)}
field.onChange(d ? (isDateTime ? formatIsoDateTime(d) : formatIsoDate(d)) : undefined)
}
/> />
)} )}
/> />