Inputs
Calendar
BitCalendar is a fully-featured inline calendar for browsing and selecting a single date, or a date and time when the built-in time picker is enabled. It offers day, month and year grids, day events with details, and flexible day/week rules such as disabled and highlighted dates, a custom first day of week and week numbers. It works with any culture and time zone, including right-to-left and non-Gregorian calendars, and every grid follows the WAI-ARIA grid pattern for the keyboard.
Culture & accessibility
Cultures and their calendar systems, the time zone the value is read and written in, form validation, and keyboard and screen-reader support.
Culture
- The default is
CultureInfo.CurrentUICulture(notCurrentCulture). The calendar system is the culture'sDateTimeFormat.Calendar. - Only the display changes: the value is still a
DateTimeOffset, and the months, years and day numbers the calendar shows are those of the culture's calendar. - DateFormat (default: the culture's short date pattern) is how the selected date is written as text - what a screen reader is told on a selection, the heading of the event dialog, and the value's text form in a form.
- A culture written right to left lays the calendar out right to left when Dir is not set (see RTL).
- The button names and tooltips are not translated by the culture: set the *Title parameters (as GoToTodayTitle below) and EventTimeFromText / EventTimeUntilText yourself.
- A date outside the range the culture's calendar supports (.NET's Hebrew calendar starts in 1583) opens the view on the nearest date it does support.
TimeZone
- The default is
TimeZoneInfo.Local: the browser's zone in WebAssembly, but the server's zone in an app rendered on the server (Blazor Server, prerendering), where a user's own zone has to be passed in. - An incoming value is converted into the zone before it is shown, so a value carrying another offset can land on a different day than its own date part says. A picked value carries the offset the zone has on that day, daylight saving time included.
- Today, the bounds, DisabledDates and HighlightedDates are all read in the same zone. The Date of an event is not converted.
Validation
aria-invalid.
- The rules come from the model: here the
[Required]attribute on the bound property, checked by theDataAnnotationsValidator. Show the message with aValidationMessageof your own; the calendar draws none. - The Required parameter does not validate. It describes the day grid as required to a
screen reader, once as the focus enters it (no single day carries
aria-required), and a Disabled or ReadOnly calendar is never described as required. - The bounds and the disabled days are not validation rules: a value outside them that comes from the model is not reported invalid, so add a rule of your own when that matters.
- InvalidErrorMessage replaces the default "The {field} field is not valid." message, which is only produced when a value given as text cannot be read with the DateFormat; DisplayName names the field in that default message.
Accessibility
- ← / →: previous/next cell, mirrored in right-to-left
- ↑ / ↓: one row up/down - a week in the day grid, four cells in the others
- Home / End: first/last cell of the week, of the year, of the range
- PageUp / PageDown: previous/next month in the day grid, year in the month grid, year range in the year grid
- Shift+PageUp / Shift+PageDown: same day of the previous/next year
- Enter / Space: activate the focused cell
- Escape: leave the event details dialog, the year grid, or a picker laid over the day grid
Crossing a month, year or range boundary navigates the calendar and keeps the focus on the cell, and disabled cells are skipped. Beyond that: AriaLabel names the whole calendar for a screen reader, each day is announced with its full date and its events, today and the current month and year carry
aria-current="date", and every button - the arrows, the spin buttons, the
AM/PM pair - has a name and a state of its own, all of them overridable through the *Title
parameters.
- A calendar given an AriaLabel (or an
aria-labelledby) becomes a named group, which tells two calendars on one page apart. - A selection is announced through a polite live region with SelectedDateAriaAtomic
(default "Selected date {0}",
{0}being the date in the DateFormat); clearing the value announces nothing. - A day that opens the event dialog reports
aria-haspopup="dialog". The dialog is modal: it keeps Tab inside it and gives the focus back to its day when it closes. - The *Title parameters with placeholders are format strings:
{0}is the month title in MonthPickerToggleTitle, the year in YearPickerToggleTitle, GoToPrevYearTitle and GoToNextYearTitle, and{0}/{1}are the first and last years of a range in the year-range titles. - FocusAsync(), called through a
@ref, puts the focus on the day of the day grid that is in the tab sequence, or on the month, the year or the hour input when another picker is on screen.
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.