Reference Source
import {Calendar} from '@adobe/coral-spectrum'
public class | source

Calendar

Expression Extends:

class Calendar extends BaseFormField(BaseComponent(HTMLElement))

A Calendar component that can be used as a date selection form field. Leverages momentJS if loaded on the page.

See:

Example:

Markup
<coral-calendar></coral-calendar>
JS constructor
new Coral.Calendar();

Member Summary

Public Members
public

Whether this field is disabled or not.

public

The format used to display the current month and year.

public

invalid: *

Inherited from BaseFormField#invalid.

public

The max selectable date in the Calendar view.

public

The minimal selectable date in the Calendar view.

public

Name used to submit the data in a form.

public

Whether this field is readOnly or not.

public

Whether this field is required or not.

public

Defines the start day for the week, 0 = Sunday, 1 = Monday etc., as depicted on the calendar days grid.

public

The current value.

public

The value returned, or set, as a Date.

public

The format to use on expressing the selected date as a string on the value attribute.

Method Summary

Public Methods
public

focus()

sets focus to appropriate descendant

Public Members

public disabled: Boolean source

Whether this field is disabled or not.

  • false by default.
  • reflected

public headerFormat: String source

The format used to display the current month and year. 'MMMM YYYY' is supported by default. Include momentjs to support additional format string options see http://momentjs.com/docs/#/displaying/.

  • "MMMM YYYY" by default.

public invalid: * source

Inherited from BaseFormField#invalid.

public max: String | Date source

The max selectable date in the Calendar view. When passed a string, it needs to be 'YYYY-MM-DD' formatted.

  • null by default.

public min: String | Date source

The minimal selectable date in the Calendar view. When passed a string, it needs to be 'YYYY-MM-DD' formatted.

  • null by default.

public name: String source

Name used to submit the data in a form.

  • "" by default.
  • reflected

public readOnly: Boolean source

Whether this field is readOnly or not. Indicating that the user cannot modify the value of the control.

  • false by default.
  • reflected

public required: Boolean source

Whether this field is required or not.

  • false by default.
  • reflected

public startDay: Number source

Defines the start day for the week, 0 = Sunday, 1 = Monday etc., as depicted on the calendar days grid.

  • 0 by default.

public value: String source

The current value. When set to 'today', the value is coerced into the clients local date expressed as string formatted in accordance to the set valueFormat.

  • "" by default.

public valueAsDate: Date source

The value returned, or set, as a Date. If the value is '' it will return null.

  • null by default.

public valueFormat: String source

The format to use on expressing the selected date as a string on the value attribute. 'YYYY-MM-DD' is supported by default. Include momentjs to support additional format string options see http://momentjs.com/docs/#/displaying/.

  • "YYYY-MM-DD" by default.
  • reflected

Public Methods

public focus() source

sets focus to appropriate descendant