Class PropertyDate
Property representing a System.DateTime value.
Inherited Members
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 8.11.0Syntax
public class PropertyDate : PropertyData, IReadOnly<PropertyData>, IReadOnly
Remarks
This class will render a date selector when put in edit mode using the EPiServer.Web.WebControls.Property webcontrol.
Constructors
PropertyDate()
Initializes a new instance of the PropertyDate class.
Declaration
public PropertyDate()
PropertyDate(DateTime)
Initializes a new instance of the PropertyDate class.
Declaration
public PropertyDate(DateTime date)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date | The initial value. |
Properties
Date
Gets or sets the value as a System.DateTime.
Declaration
public DateTime Date { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime | The value as a System.DateTime. |
MaxValue
Gets the highest value that can be saved.
Declaration
public static DateTime MaxValue { get; }
Property Value
Type | Description |
---|---|
System.DateTime | The highest value that can be saved. |
Remarks
The highest value is currently 9999-12-31.
MinValue
Gets the lowest value that can be saved.
Declaration
public static DateTime MinValue { get; }
Property Value
Type | Description |
---|---|
System.DateTime | The lowest value that can be saved. |
Remarks
The lowest value is currently 1753-01-01.
PropertyValueType
Gets the System.Type of the property value.
Declaration
public override Type PropertyValueType { get; }
Property Value
Type | Description |
---|---|
System.Type | The System.Type of the property value. |
Overrides
Type
Property type as defined by enum PropertyDataType.
Declaration
public override PropertyDataType Type { get; }
Property Value
Type | Description |
---|---|
PropertyDataType | The type as defined by enum PropertyDataType. |
Overrides
Value
Gets or sets the value of the property.
Declaration
public override object Value { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The value of the property. |
Overrides
Remarks
Value returns null if the property has no value defined.
Methods
CreatePropertyControl()
Creates a new instance of PropertyDateControl.
Declaration
public override IPropertyControl CreatePropertyControl()
Returns
Type | Description |
---|---|
IPropertyControl | A PropertyDateControl that is used to display a user interface for the property. |
Overrides
Remarks
It is possible to change which control should be used by registering a different IPropertyControl for the PropertyData class in PropertyControlClassFactory.
IsValidDate(DateTime)
Determines whether [is valid date] [the specified date].
Declaration
public static bool IsValidDate(DateTime date)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | date | The date. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Parse(String)
Creates a PropertyDate from a string.
Declaration
public static PropertyDate Parse(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string to create a PropertyDate from. |
Returns
Type | Description |
---|---|
PropertyDate | A PropertyDate. |
Remarks
If the string is null or Empty an empty PropertyDate is returned. If the string cannot be parsed as a System.DateTime an InvalidPropertyValueException is thrown.
ParseToObject(String)
A wrapper for System.String to return a generic PropertyData object.
Declaration
public override PropertyData ParseToObject(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string to create a PropertyDate from. |
Returns
Type | Description |
---|---|
PropertyData | A PropertyDate. |
Overrides
Remarks
If the string is null or Empty an empty PropertyDate is returned. If the string cannot be parsed as a System.DateTime an InvalidPropertyValueException is thrown.
ParseToSelf(String)
Sets the value of the property to the parsed value.
Declaration
public override void ParseToSelf(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The string to create a PropertyDate from. |
Overrides
Remarks
If the string is null or Empty an empty PropertyDate is returned. If the string cannot be parsed as a System.DateTime an InvalidPropertyValueException is thrown.
SetDefaultValue()
Sets the default value for this property.
Declaration
protected override void SetDefaultValue()