Date Only

Schema Alias: Umbraco.DateOnly

UI Alias: Umb.PropertyEditorUi.DateOnlyPicker

Returns: DateOnly?

The Date Only property editor provides an interface for selecting dates without including time or time zone information. It focuses purely on date selection and returns a DateOnly value.

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 Date Only from the list of available property editors.

This editor has no configuration options.

Editing experience

Adding or editing a value

You will be presented with a date input.

Date Only property editor interface

Rendering

The value returned will have the type DateOnly?.

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 date as an ISO 8601 string with midnight time and UTC offset.

Storage format

The property editor stores values in this JSON format:

The property editor handles date-only values. Time is set to 00:00:00 and offset to +00:00 for storage consistency. These time components are ignored in the Date Only context.

  1. Create a C# model that matches the JSON schema.

  2. Convert your existing date value to DateTimeOffset for storage.

    If you have a DateOnly:

    If you have a DateTime:

  3. Create an instance of the class with the DateTimeOffset value.

  4. Inject the IJsonSerializer and use it to serialize the object.

  5. Inject the IContentService to retrieve and update the value of a property of the desired content item.

Last updated

Was this helpful?