Class DateTimeField<T>
A field for storing and displaying dates and times.
public class DateTimeField<T> : TrinityField<DateTimeField<T>, T>, ITrinityComponent, ITrinityField, IFormComponent
Type Parameters
T
- Inheritance
-
TrinityComponent<DateTimeField<T>, T>TrinityField<DateTimeField<T>, T>DateTimeField<T>
- Implements
- Derived
- Inherited Members
Constructors
DateTimeField(string)
public DateTimeField(string columnName)
Parameters
columnName
string
Properties
ComponentName
The component name in the front-end side.
public override string ComponentName { get; }
Property Value
DateFormat
Gets or sets the date format of the date time field.
public string? DateFormat { get; protected set; }
Property Value
DisabledDates
Gets or sets an array of disabled dates. If a date is present in this array, it will be disabled in the date picker.
public DateTime[]? DisabledDates { get; protected set; }
Property Value
- DateTime[]
DisabledDays
Gets or sets the days of the week that are disabled in the date and time field.
public int[]? DisabledDays { get; protected set; }
Property Value
- int[]
HourFormat
Gets or sets the hour format of the date time field.
public string? HourFormat { get; protected set; }
Property Value
IconPos
Gets or sets the position of the icon in the date picker.
public string? IconPos { get; protected set; }
Property Value
Inline
Gets or sets a value indicating whether the date time field should be displayed inline.
public bool Inline { get; protected set; }
Property Value
MaxDate
Gets or sets the maximum date value allowed in the date and time field.
public DateTime? MaxDate { get; protected set; }
Property Value
MinDate
Gets or sets the minimum date value allowed in the date and time field.
public DateTime? MinDate { get; protected set; }
Property Value
SelectionMode
Gets or sets the selection mode of the date time field.
public string SelectionMode { get; protected set; }
Property Value
ShowIcon
Gets or sets a value indicating whether to show an icon in the date picker.
public bool ShowIcon { get; protected set; }
Property Value
ShowTime
Gets or sets a value indicating whether to show the time portion of the date and time field.
public bool ShowTime { get; protected set; }
Property Value
TimeOnly
Gets or sets a value indicating whether to display only the time portion of the date and time field.
public bool TimeOnly { get; protected set; }
Property Value
View
Gets or sets the current view of the date picker.
public string? View { get; protected set; }
Property Value
Methods
SetAsInline(bool)
Sets the date time field to be displayed inline or not.
public DateTimeField<T> SetAsInline(bool inline = true)
Parameters
inline
boolA boolean value indicating whether the field should be displayed inline or not.
Returns
- DateTimeField<T>
The current instance of the DateTimeField class.
SetDateFormat(string)
Sets the date format of the date time field.
public DateTimeField<T> SetDateFormat(string format)
Parameters
format
stringThe format to be set.
Returns
- DateTimeField<T>
The current instance of the DateTimeField class.
SetDisabledDates(params DateTime[])
Sets an array of disabled dates. If a date is present in this array, it will be disabled in the date picker.
public DateTimeField<T> SetDisabledDates(params DateTime[] dates)
Parameters
dates
DateTime[]An array of dates to disable.
Returns
- DateTimeField<T>
The current instance of the DateTimeField<T> class.
SetDisabledDays(params int[])
Sets the days of the week that are disabled in the date and time field.
public DateTimeField<T> SetDisabledDays(params int[] days)
Parameters
days
int[]An array of integers representing the days of the week to disable in the date and time field.
Returns
- DateTimeField<T>
The current instance of the DateTimeField<T> class.
SetHourFormat(HourFormatTypes)
Sets the hour format of the date time field.
public DateTimeField<T> SetHourFormat(HourFormatTypes format = HourFormatTypes.AmPm)
Parameters
format
HourFormatTypesThe type of hour format to be set.
Returns
- DateTimeField<T>
The current instance of the DateTimeField class.
SetMaxDate(DateTime)
Sets the maximum date value allowed in the date and time field.
public DateTimeField<T> SetMaxDate(DateTime max)
Parameters
max
DateTimeThe maximum date value allowed in the date and time field.
Returns
- DateTimeField<T>
The current instance of the DateTimeField<T> class.
SetMinDate(DateTime)
Sets the minimum date value allowed in the date and time field.
public DateTimeField<T> SetMinDate(DateTime min)
Parameters
min
DateTimeThe minimum date value allowed in the date and time field.
Returns
- DateTimeField<T>
The current instance of the DateTimeField<T> class.
SetShowIcon(bool, string)
Sets a value indicating whether to show an icon in the date picker and its position.
public DateTimeField<T> SetShowIcon(bool show = true, string iconPos = "left")
Parameters
show
boolTrue to show the icon, false to hide it.
iconPos
stringThe position of the icon. Valid values are "left" and "right".
Returns
- DateTimeField<T>
The current instance of the DateTimeField<T> class.
SetShowTime(bool)
Sets the value indicating whether to show the time portion of the date and time field.
public DateTimeField<T> SetShowTime(bool show = true)
Parameters
show
boolA value indicating whether to show the time portion of the date and time field. Default is true.
Returns
- DateTimeField<T>
The current instance of the DateTimeField<T> class.
SetTimeOnly(bool)
Sets the value indicating whether to display only the time portion of the date and time field.
public DateTimeField<T> SetTimeOnly(bool timeOnly = true)
Parameters
timeOnly
boolA value indicating whether to display only the time portion of the date and time field. Default is true.
Returns
- DateTimeField<T>
The current instance of the DateTimeField<T> class.
SetView(ViewTypes)
Sets the view of the date picker.
public DateTimeField<T> SetView(ViewTypes view)
Parameters
view
ViewTypesThe view type to set.
Returns
- DateTimeField<T>
The current instance of the DateTimeField<T> class.