Skip to main content
Version: 1.x

@microsoft/fast-foundation > Calendar

Calendar class

Calendar component

  • The default slot for calendar content

dateselected - Fires a custom 'dateselected' event when Enter is invoked via keyboard on a date

Signature:
export declare class Calendar extends FoundationElement 

Properties

PropertyModifiersTypeDescription
dateFormatterDateFormatterdate formatter utitlity for getting localized strings
dayFormatDayFormatFormat style for the day
disabledDatesstringA list of dates that should be shown as disabled
localestringString repesentation of the full locale including market, calendar type and numbering system
minWeeksnumberMinimum number of weeks to show for the month This can be used to normalize the calendar view when changing or across multiple calendars
monthnumberMonth to display
monthFormatMonthFormatFormat style for the month label
readonlybooleanReadonly attribute for turning off data-grid
selectedDatesstringA list of dates that should be shown as highlighted
weekdayFormatWeekdayFormatFormat style for the week day labels
yearnumberYear of the month to display
yearFormatYearFormatFormat style for the year used in the title

Methods

MethodModifiersDescription
dateInString(date, datesString)A helper function that checks if a date exists in a list of dates
getDayClassNames(date, todayString)Creates a class string for the day container
getDays(info, minWeeks)A list of calendar days
getMonthInfo(month, year)Gets data needed to render about a calendar month as well as the previous and next months
getWeekdayText()Returns a list of weekday labels
handleDateSelect(event, day)Emits the "date-select" event with the day, month and year.
handleKeydown(event, date)Handles keyboard events on a cell