Time Only
Schema Alias: Umbraco.TimeOnly
UI Alias: Umb.PropertyEditorUi.TimeOnlyPicker
Returns: TimeOnly?
The Time Only property editor provides an interface for selecting times. It excludes date and time zone information, and returns strongly-typed TimeOnly values.
Configuration
You can configure this property editor in the same way as any standard property editor, using the Data Types admin interface.
To set up a property using this editor, create a new Data Type and select Time Only from the list of available property editors.
You will see the configuration options as shown below.

Time format - Specifies the level of precision for time values shown and stored by the editor.
Time format
HH:mm - Displays hours and minutes (e.g.,
14:30). Suitable for most general use cases.
HH:mm:ss - Displays hours, minutes, and seconds (e.g.,
14:30:45). Use this when you need more precise timing.
Editing experience
Adding or editing a value
You will be presented with a time input. Unlike date-time editors, this editor focuses only on the time component.

Rendering
The value returned will have the type TimeOnly?.
Display the value
With Models Builder:
Without Models Builder:
Add values programmatically
This property editor stores values as a JSON object. The object contains the time as an ISO 8601 string with a default date and UTC offset.
Storage format
The property editor stores values in this JSON format:
The property editor handles time-only values. Date is set to a default value (0001-01-01) and offset to +00:00 for storage consistency. The date component is ignored in the Time Only context.
Create a C# model that matches the JSON schema.
Convert your existing time value to
DateTimeOffsetfor storage.If you have a
TimeOnly:If you have a
DateTime:Create an instance of the class with the
DateTimeOffsetvalue.Inject the
IJsonSerializerand use it to serialize the object.Inject the
IContentServiceto retrieve and update the value of a property of the desired content item.
Last updated
Was this helpful?