Class DateOnlyValueConverter
Provides a property value converter for date only datetime property editors.
Namespace: Umbraco.Cms.Core.PropertyEditors.ValueConverters
Assembly: Umbraco.Infrastructure.dll
Syntax
public class DateOnlyValueConverter : DateTimeValueConverterBase, IPropertyValueConverter, IDiscoverable
Remarks
This is one of four property value converters derived from DateTimeValueConverterBase and storing their value as JSON with timezone information.
Constructors
View SourceDateOnlyValueConverter(IJsonSerializer, ILogger<DateOnlyValueConverter>)
Initializes a new instance of the DateOnlyValueConverter class.
Declaration
public DateOnlyValueConverter(IJsonSerializer jsonSerializer, ILogger<DateOnlyValueConverter> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| IJsonSerializer | jsonSerializer | |
| ILogger<DateOnlyValueConverter> | logger |
Methods
View SourceConvertToObject(DateTimeDto)
Convert the intermediate representation to the final object.
Declaration
protected override object ConvertToObject(DateTimeValueConverterBase.DateTimeDto dateTimeDto)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTimeValueConverterBase.DateTimeDto | dateTimeDto | The intermediate representation. |
Returns
| Type | Description |
|---|---|
| object | The final object. |
GetPropertyValueType(IPublishedPropertyType)
Gets the type of values returned by the converter.
Declaration
public override Type GetPropertyValueType(IPublishedPropertyType propertyType)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedPropertyType | propertyType | The property type. |
Returns
| Type | Description |
|---|---|
| Type | The CLR type of values returned by the converter. |
Remarks
Some of the CLR types may be generated, therefore this method cannot directly return a Type object (which may not exist yet). In which case it needs to return a ModelType instance.
IsConverter(IPublishedPropertyType)
Gets a value indicating whether the converter supports a property type.
Declaration
public override bool IsConverter(IPublishedPropertyType propertyType)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedPropertyType | propertyType | The property type. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether the converter supports a property type. |