enhancement
major
minor
major
minor
minor
#29873
TL Views: a time input (ReactDatePickerControl.Kind.TIME) cannot enter or show seconds
tl-layout-react 8.0.0-alpha10, ReactDatePickerControl.Kind.TIME.
Problem
The time input uses the ISO pattern HH:mm (the client <input type="time"> without a step), so a time of day cannot be entered or shown with seconds. A value with seconds set programmatically (e.g. "now") keeps them in the model until the field is edited, but the field shows only hours and minutes.
In E-Home the group monitor sends a time of day (KNX DPT 10.001: hours, minutes, seconds); the user can only send full minutes.
Reproduction
<value-input type="tl.core:Time" value="time"/>
(or any input resolved to Kind.TIME): the browser offers HH:mm only.
Expected
An option for the precision of a time (and date-time) input - e.g. seconds - that sets the ISO pattern HH:mm:ss and the client input's step="1", usable from a <value-input> (annotation <format> or an input-control option).
Workaround in E-Home
None; recorded in doc/tl-todo.md.
Lösung
The precision of a time and date-time input follows the field's display format: a field whose display format writes seconds also edits seconds.
- ReactDatePickerControl derives the precision (minutes or seconds) from its effective display format - by formatting two moments one second apart, so any DateFormat works - and exchanges the value with the client in the matching ISO form (HH:mm:ss, yyyy-MM-dd'T'HH:mm:ss). The state (DatePickerState) carries the precision; the HTML input gets step="1" for seconds, the MUI adapter chooses its ISO format and picker views (hours, minutes, seconds) from the same state. Parsing a client value requires the whole text to be consumed, so a time with seconds is no longer read by the minutes pattern as a prefix.
- Configuration is the existing <format> annotation, at the attribute or inside a <value-input>; no new annotation. A format writing seconds gives an input editing seconds:
<property name="timeSeconds" type="tl.core:Time">
<annotations>
<format>
<time style="medium"/>
</format>
</annotations>
</property>
(<format-ref format-id="time"/> or <date-time date-style="medium" time-style="medium"/> likewise.) For the reproduction above:
<value-input type="tl.core:Time" value="time">
<format>
<time style="medium"/>
</format>
</value-input>
- Without a <format> of its own, a time input keeps editing minutes: the attribute settings (ElementConf.config.xml) give the datatype tl.core:Time - and so every attribute and every <value-input> of that type - the display format short-time, and tl.core:DateTime carries medium-date-time (short time part). Existing applications are unchanged.
- The config editor's DatePickerFormatProvider takes an optional format (the same definitions as the <format> annotation) that decides the precision; the mapping for TimeOfDayAsDateValueProvider uses the short time format, as that value provider stores no seconds.