DateTimePicker Typescript API

Interface

DateTimePicker

Date & time selection component. It allows to select both date and time with the same control.

Selector

smart-date-time-picker

Properties

animationAnimation

Sets or gets the animation mode. Animation is disabled when the property is set to 'none'

Default valueadvanced

animationSettingsany

Applies new animation settings to the calendar pop-up when it is enabled.

Properties:
startSpeed - Determines the initial speed of the animation.
easeThreshold - Determines the point at which the animation starts to slow down - the "ease effect".
step - Determines the step ( scrolling interval ) at which the animation will run.
stepEaseSize - Coefficient that is used to calculated the new step once the threshold has been passed.
resetThreshold - Determines the threshold for animation reset. When it's reached the animation will start over.

autoCloseboolean

Determines whether the calendar button pop-up will be closed automatically when date or time is selected through it.

Default valuefalse

autoCloseDelayboolean

Determines the delay before the calendar pop-up is automatically closed. Applicable only when autoClose is set to true.

Default value500

calendarButtonboolean

Determines whether the calendar button is visible or not. The calendar button is used to open the Calendar popup to select a date.

Default valuefalse

calendarButtonPositionDropDownButtonPosition

Determines the position of the calendar button.

Default valueright

calendarModeCalendarMode

Determines the header mode of the calendar pop-up.

Default valuedefault

dayNameFormatDayFormat

Sets or gets the format of calendar pop-up's day names.

Default valuefirstTwoLetters

disabledboolean

Enables or disables the element.

Default valuefalse

disableAutoNavigationboolean

Disables auto navigation of the calendar pop-up when the user clicks on a date that's not from month in view.

Default valuefalse

displayKindDateTimePickerDisplayKind

Determines the time zone to display the value in.

Default valueunspecified

displayModeViewCalendarDisplayModeView

Determines the type of the month/year view in the calendar pop-up when calendarMode is set to Default.

Default valuetable

dropDownAppendToany

Sets custom container to append the pop-up to. By default, it is in the DateTimePicker. The value of the property can be an HTML element or the id of an HTML element.

dropDownDisplayModeDateTimePickerDropDownDisplayMode

Sets or gets the pop-up display mode (what components appear in it, and its behaviour).

Default valuedefault

dropDownOverlayboolean

If this property is enabled, when the element's dropdown is opened, a transparent overlay is positioned between the dropdown and the rest of the document.

Default valuefalse

dropDownPositionDropDownPosition

Determines the pop-up position when opened.

Default valueauto

editModeDateTimePickerEditMode

Determines how the the value can be edited inside the input.

Default valuedefault

enableMouseWheelActionboolean

Determines whether the value can be incremented/decremented with the mouse wheel when the mouse is over the input.

Default valuefalse

firstDayOfWeeknumber

Determines the first day of the week of the calendar pop-up. From 0(Sunday) to 6(Saturday)

Default value0

footerTemplateany

Sets or gets the footer template of the calendar pop-up. The value of this property can be the id of an HTMLTemplateElement or the HTMLTemplateElement itself. If set to null, a default template is applied.

formatStringstring

Determines the pattern that is used to display the value in.

Default value"dd-MMM-yy HH:mm:ss.fff

headerTemplateany

Sets custom header template for the calendar pop-up. Accepts the id of an HTMLTemplateElement or a reference ot it.

hideDayNamesboolean

Hides the names of the weekdays in the calendar pop-up.

Default valuefalse

hideOtherMonthDaysboolean

Determines if dates from other months are visible or not in the calendar pop-up.

Default valuefalse

hideTooltipArrowboolean

Hides the arrow of the tooltip in the calendar pop-up.

Default valuefalse

hintstring

Sets additional helper text below the element that appears only when the element is focused.

Default value"

importantDatesstring[]

Sets dates, displayed as important in the calendar pop-up.

importantDatesTemplatestring | HTMLTemplateElement

Sets a template for the important dates of the calendar pop-up. Accepts the id of or a reference to an HTMLTemplateElement.

intervalany

Sets or gets the increment/decrement interval when a date/time segment inside the input has not been highlighted. The default interval is 1 second. If a numeric value is passed, it represents milliseconds.

Default valuenew Smart.Utilities.TimeSpan(0, 0, 1)

labelstring

Sets a label above the element.

Default value"

localestring

Sets or gets the locale that determines what language is used to localize the labels inside the DateTimePicker.

Default value"en

localizeFormatFunctionany

Callback used to customize the format of the messages that are returned from the Localization Module.

maxany

Sets or gets the maximum allowed value.

Default valuenew Smart.Utilities.DateTime(3001, 1, 1)

messagesany

Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale.

Default value


"en": {

"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",

"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",

"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",

"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",

"moduleUndefined": "Module is undefined.",

"missingReference": "{{elementType}}: Missing reference to {{files}}.",

"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",

"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM.",

"now": "Now",

"dateTabLabel": "DATE",

"timeTabLabel": "TIME"

}


minany

Sets or gets the minimum allowed value.

Default valuenew Smart.Utilities.DateTime(1600, 1, 1)

namestring

Sets or gets the element's name, which is used as a reference when the data is submitted in a form.

Default value"

nullableboolean

Enables or disables the setting of the value property to be null or empty string. If the property is enabled and the value in the input is deleted, the value will be set to null and the placeholder will be displayed. Otherwise, the current date and time will be set.

Default valuefalse

openedboolean

Sets or gets whether the calendar pop-up is opened.

Default valuefalse

placeholderstring

Sets or gets the placeholder text to be shown in the input when value is null.

Default value"Enter date

readonlyboolean

Disables user interaction with the element.

Default valuefalse

restrictedDatesDate[]

Sets or gets an array of dates (DateTime or Date objects) that cannot be selected.

rightToLeftboolean

Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.

Default valuefalse

spinButtonsboolean

Sets or gets whether the spin buttons are displayed. Spin buttons are used to increment/decrement the date/time.

Default valuefalse

spinButtonsDelaynumber

Sets the delay between repeats of the spin buttons in miliseconds.

Default value75

spinButtonsInitialDelaynumber

Sets a delay before the first repeat iteration of spin buttons in miliseconds.

Default value0

spinButtonsPositionDateTimePickerSpinButtonsPosition

Sets or gets the position of the spin buttons.

Default valueright

themestring

Sets or gets the element's visual theme.

Default value"

tooltipboolean

Enables/Disabled the tooltip for the important dates in the calendar pop-up.

Default valuefalse

tooltipDelaynumber

Sets the delay of the calendar pop-up's tooltip before it appears.

Default value100

tooltipPositionTooltipPosition

Sets the position of the tooltip in the calendar pop-up.

Default valuetop

tooltipTemplatestring | HTMLTemplateElement

Sets a template for the content of the calendar pop-up's tooltip. Accepts the id of or a reference to an HTMLTemplateElement.

unfocusableboolean

Sets or gets if the element can be focused.

Default valuefalse

validationValidation

Determines the validation mechanism for the value by min/max.

Default valuestrict

valueany

Sets or gets the value. The value represents the current date/time that is set to the element as a DateTime object.

Default valuenew Smart.Utilities.DateTime()

weekNumbersboolean

Enables/Disabled week numbering in the calendar pop-up.

Default valuefalse

weeksnumber

Determines the number of visible weeks in the calendar pop-up.

Default value6

yearCutoffnumber

Determines the first year of a 100 year span within which 2-digit years fall. The default value, 1926, would interpret the 2-digit year values 26-99 as 1926 to 1999 and values 00-25 as being 2000 to 2025.

Default value1926

onchange((this: Window, ev: Event) => any) | null

This event is triggered when the value is changed.

Arguments

evEvent
ev.detailObject
ev.detail.oldValue - The old value before it was changed presented as a DateTime object.
ev.detail.value - The new value presented as a DateTime object.

onclose((this: Window, ev: Event) => any) | null

This event is triggered when the calendar pop-up is closed.

Arguments

evEvent

onclosing((this: Window, ev: Event) => any) | null

This event is triggered when the calendar pop-up is about to be closed. The closing operation can be canceled by calling event.preventDefault() in the event handler function.

Arguments

evEvent

onopen((this: Window, ev: Event) => any) | null

This event is triggered when the calendar pop-up is opened.

Arguments

evEvent

onopening((this: Window, ev: Event) => any) | null

This event is triggered when the calendar pop-up is about to be opened. The opening operation can be canceled by calling event.preventDefault() in the event handler function.

Arguments

evEvent

Methods

close(): void

Closes the calendar pop-up.


focus(): void

Focuses the input.


open(): void

Opens the calendar pop-up.


select(): void

Selects the text inside the input.



Enums

Animation

None Simple Advanced

CalendarDisplayModeView

Table List

CalendarMode

Default Classic

DateTimePickerDisplayKind

UTC Local Unspecified

DateTimePickerDropDownDisplayMode

Auto Default Classic Calendar TimePicker

DateTimePickerEditMode

Default Full Partial

DateTimePickerSpinButtonsPosition

Left Right

DayFormat

Narrow FirstTwoLetters Long Short

DropDownButtonPosition

Left Right

DropDownPosition

Auto Top Bottom OverlayTop OverlayCenter OverlayBottom CenterBottom CenterTop

TooltipPosition

Auto Absolute Bottom Top Left Right

Validation

Strict Interaction