Class DatePicker

Allows users to pick a date value.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(element?: HTMLElement, options?: any): DatePicker

Initializes a new instance of the DatePicker control.

constructor

Parameters

  • element?: HTMLElement optional

    The DOM element associated with the DatePicker control.

  • options?: any optional

    The set of options to be applied initially to the DatePicker control. The options are the following: calendar, current, datePattern, disabled, maxYear, minYear, monthPattern, yearPattern.

Returns

DatePicker

Properties

public calendar: string

Gets or sets the calendar to use.

public current: Date

Gets or sets the current date of the DatePicker. You can use either a date string or a Date object to set this property.

public datePattern: string

Gets or sets the display pattern for the date. The default date pattern is day.integer(2). You can change the date pattern by changing the number of integers displayed.

public disabled: boolean

Specifies whether the DatePicker is disabled.

public element: HTMLElement

Gets the DOM element for the DatePicker.

public maxYear: number

Gets or sets the maximum Gregorian year available for picking.

public minYear: number

Gets or sets the minimum Gregorian year available for picking.

public monthPattern: string

Gets or sets the display pattern for the month. The default month pattern is month.abbreviated. You can change the month pattern to the following values: month.full. The full name of the month. month.abbreviated(n). You can use abbreviated with or without specifying the number of letters in the abbreviation. If you do specify the number of letters, the actual length of the month name that appears may vary. month.solo.full. A representation of the month that is suitable for stand-alone display. You can also use month.solo.abbreviated(n). month.integer(n). You can use integer with or without specifying the number of integers.

public yearPattern: string

Gets or sets the display pattern for the year. The default year pattern is year.full. You can change the year pattern to the following values: year.abbreviated(n). You can use abbreviated with or without specifying the number of letters in the abbreviation.

Methods

public addEventListener(type: string, listener: Function, capture?: boolean)

Adds an event listener.

Parameters

  • type: string

    The type (name) of the event.

  • listener: Function

    The function that handles the event.

  • capture?: boolean optional

    If true, specifies that capture should be initiated, otherwise false.

public dispatchEvent(type: string, eventProperties: any): boolean

Raises an event of the specified type and with additional properties.

Parameters

  • type: string

    The type (name) of the event.

  • eventProperties: any

    The set of additional properties to be attached to the event object when the event is raised.

Returns

boolean

true if preventDefault was called on the event, otherwise false.

public dispose()

Releases resources held by this DatePicker. Call this method when the DatePicker is no longer needed. After calling this method, the DatePicker becomes unusable.

public onchange(eventInfo: CustomEvent)

Occurs when any of the controls are changed by the user.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public raiseEvent(type: string, eventProperties: any): boolean

Raises an event of the specified type and with additional properties.

Parameters

  • type: string

    The type (name) of the event.

  • eventProperties: any

    The set of additional properties to be attached to the event object when the event is raised.

Returns

boolean

true if preventDefault was called on the event, otherwise false.

public removeEventListener(type: string, listener: Function, useCapture?: any)

Removes a listener for the specified event.

Parameters

  • type: string

    The name of the event for which to remove a listener.

  • listener: Function

    The listener.

  • useCapture?: any optional

    Optional. The same value that was passed to addEventListener for this listener. It may be omitted if it was omitted when calling addEventListener.