Datepicker
A calendar and date picker popup, opened from an input or a button, with range selection, multiple months and more.
Bootstrap’s datepicker docs describe the markup and CSS.
Overview
Add bsDatepicker to a text input. The calendar opens below it on focus or click, and closes after you pick a date, on Escape, on a click outside, or when focus leaves it. ↓ moves focus into the calendar. The value is an ISO date (YYYY-MM-DD), which the input shows and accepts when typed. On macOS and iPadOS the input gets inputmode="numeric", so the iPad on-screen keyboard shows the keys a date needs; iPhones keep the default keyboard. Unlike Bootstrap’s datepicker, the calendar is rendered by Angular, with no Vanilla Calendar Pro dependency.
Value: none
<label bsFormLabel for="datepicker1">Datepicker</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepicker1"
class="w-12"
autocomplete="off"
placeholder="Choose date…"
[formControl]="date" />
<p class="mt-3 mb-0 fg-3">Value: {{ date.value ?? 'none' }}</p>With form field
Use a form field for a label, description and validation feedback.
<div bsFormField>
<label bsFormLabel>Datepicker field</label>
<input
type="text"
bsFormControl
bsDatepicker
class="w-12"
autocomplete="off"
placeholder="Choose date…" />
<small bsFormText>We’ll send a reminder the day before.</small>
</div>With icon
Put the input in a form adorn with end for a calendar icon on the right. The calendar lines up with the adorn.
<label bsFormLabel for="datepickerIcon">Select date</label>
<label bsFormAdorn end class="w-12">
<span bsFormAdornIcon>
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16" aria-hidden="true">
<path
d="M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-5 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5z" />
<path
d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4z" />
</svg>
</span>
<input
type="text"
class="form-ghost"
bsDatepicker
id="datepickerIcon"
autocomplete="off"
placeholder="Choose date…" />
</label>Min and max dates
Restrict the selectable dates with min and max, or with a dateDisabled function, such as one that disables weekends. The date helpers turn the ISO dates it receives into Date objects.
<div class="d-flex flex-wrap gap-3">
<div>
<label bsFormLabel for="datepickerMinMax">Event date (2026 only)</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerMinMax"
class="w-12"
autocomplete="off"
min="2026-01-01"
max="2026-12-31"
placeholder="Select a date in 2026" />
</div>
<div>
<label bsFormLabel for="datepickerWeekdays">Weekday</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerWeekdays"
class="w-12"
autocomplete="off"
placeholder="Mon to Fri"
[dateDisabled]="weekend" />
</div>
</div>Typed dates
Inputs accept dates typed as YYYY-MM-DD, and in the format dateFormat options show, such as 27/11/2026 or Nov 27, 2026. With wareki, they also accept Japanese era dates such as 令和8年11月27日. For other formats, such as one a dateFormat function shows, set dateParser to a function that returns the typed date as YYYY-MM-DD, or null to fall back to the built-in parsing. Typed dates are still checked against min, max and dateDisabled. Text that isn’t accepted is put back to the selected dates, and textInvalid emits it with the reason. Set invalidBehavior="keep" to leave it in the input to fix instead: the value becomes empty, textError gives the reason, and forms get a bsDate validation error, so bsInvalidFeedback shows.
<div bsFormField>
<label bsFormLabel>Delivery date</label>
<input
type="text"
bsFormControl
bsDatepicker
#picker="bsDatepicker"
class="w-12"
autocomplete="off"
locale="en-GB"
min="2026-01-01"
max="2026-12-31"
invalidBehavior="keep"
placeholder="DD/MM/YYYY"
[dateFormat]="format"
[formControl]="date" />
<small bsFormText>Type a date in 2026, such as 27/11/2026, or pick one.</small>
<div bsInvalidFeedback>
@if (picker.textError() === 'parse') {
Enter the date as DD/MM/YYYY.
} @else {
Choose a date in 2026.
}
</div>
</div>Month and year
Click the month in the header to pick from the twelve months, or the year to pick from fifteen years at a time, like Bootstrap’s datepicker. The arrow buttons page through the years. Picking a month or a year shows its days again, and months and years outside min and max can’t be picked. This makes far-away dates, such as a date of birth, quick to reach. Set monthSelection or yearSelection to false on bsCalendar, or in provideBsCalendarConfig() for datepickers too, to show plain text instead.
<label bsFormLabel for="datepickerBirthday">Date of birth</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerBirthday"
class="w-12"
autocomplete="bday"
locale="en-US"
min="1900-01-01"
[max]="today"
placeholder="YYYY-MM-DD" />Multiple dates
Set selectionMode="multiple" to pick several dates. The value is an array, and the calendar stays open while you pick.
<label bsFormLabel for="datepickerMultiple">Select multiple dates</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerMultiple"
autocomplete="off"
selectionMode="multiple"
placeholder="Select dates…"
[(value)]="dates" />Date range
Set selectionMode="range" to pick a start and an end date, and monthsCount to show months side by side. The calendar closes once both dates are picked.
<label bsFormLabel for="datepickerRange">Select date range</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerRange"
autocomplete="off"
selectionMode="range"
monthsCount="2"
placeholder="Select start and end dates…"
[(value)]="stay" />First day of week
Weeks start on Monday. Set firstWeekday to 0 to start on Sunday. Set locale for month and day names in another language.
<div class="d-flex flex-wrap gap-3">
<div>
<label bsFormLabel for="datepickerSunday">Week starts on Sunday</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerSunday"
class="w-12"
autocomplete="off"
firstWeekday="0"
locale="en-US"
placeholder="Select a date" />
</div>
<div>
<label bsFormLabel for="datepickerFrench">In French</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerFrench"
class="w-12"
autocomplete="off"
locale="fr-FR"
placeholder="Choisir une date"
calendarLabel="Choisir une date" />
</div>
</div>Week numbers
Add weekNumbers to show each week’s number before it. Weeks are numbered by ISO 8601, where week 1 holds the year’s first Thursday. Set weekNumbering="simple" to make week 1 the week holding 1 January, as in the US with firstWeekday="0". The numbers are row headers of the date grid, so screen readers announce them with the dates.
<div class="d-flex flex-wrap gap-3">
<div>
<label bsFormLabel for="datepickerWeekIso">ISO week numbers</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerWeekIso"
class="w-12"
autocomplete="off"
weekNumbers
placeholder="Select a date" />
</div>
<div>
<label bsFormLabel for="datepickerWeekSimple">Weeks from 1 January</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerWeekSimple"
class="w-12"
autocomplete="off"
weekNumbers
weekNumbering="simple"
firstWeekday="0"
locale="en-US"
placeholder="Select a date" />
</div>
</div>Japanese era years
Add wareki to show years as Japanese era years (和暦), followed by the Gregorian year, such as 令和8年(2026). The year comes before the month in the header, and the year view lists era years one per row. A year with two eras, such as 2019, is named after the era it ends in. Era names come from Intl.DateTimeFormat’s japanese calendar in the locale, so set a Japanese locale such as ja-JP. Values stay ISO dates; to show the picked date with its era, set dateFormat to options with calendar: 'japanese'.
<div class="d-flex flex-wrap align-items-end gap-3">
<div>
<label bsFormLabel for="datepickerWareki">Date</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerWareki"
class="w-12"
autocomplete="off"
locale="ja-JP"
firstWeekday="0"
wareki
placeholder="YYYY-MM-DD" />
</div>
<button
type="button"
bsButton="outline"
theme="secondary"
bsDatepicker
locale="ja-JP"
firstWeekday="0"
wareki
[dateFormat]="eraDate"
[(value)]="date">
<span bsDatepickerDisplay>日付を選択</span>
</button>
</div>Placement
Set placement to open the calendar elsewhere. It flips when there isn’t room.
<div class="d-flex flex-wrap gap-3">
<div>
<label bsFormLabel for="datepickerStart">Start aligned</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerStart"
autocomplete="off"
placement="bottom-start"
placeholder="Start" />
</div>
<div>
<label bsFormLabel for="datepickerCenter">Centered</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerCenter"
autocomplete="off"
placement="bottom"
placeholder="Center" />
</div>
<div>
<label bsFormLabel for="datepickerEnd">End aligned</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerEnd"
autocomplete="off"
placement="bottom-end"
placeholder="End" />
</div>
</div>Sizes
Set size to sm or lg to add .form-control-sm or .form-control-lg, like a form control. Set a default for every datepicker with provideBsDatepickerConfig({ size: 'sm' }). Button datepickers ignore it; size them with the button’s own size.
<div class="d-flex flex-wrap align-items-end gap-3">
<div>
<label bsFormLabel for="datepickerSmall">Small</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerSmall"
size="sm"
autocomplete="off"
placeholder="Choose date…" />
</div>
<div>
<label bsFormLabel for="datepickerDefault">Default</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerDefault"
autocomplete="off"
placeholder="Choose date…" />
</div>
<div>
<label bsFormLabel for="datepickerLarge">Large</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerLarge"
size="lg"
autocomplete="off"
placeholder="Choose date…" />
</div>
</div>Button trigger
Use bsDatepicker on a button, for example for a dashboard date filter. A click opens the calendar and moves focus into it. Put the text in a bsDatepickerDisplay element to keep icons when a date is picked. Buttons show dates in the locale’s medium format; change it with dateFormat.
<div class="d-flex flex-wrap gap-3">
<button type="button" bsButton="outline" theme="secondary" bsDatepicker [(value)]="date">
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16" aria-hidden="true">
<path
d="M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-5 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5z" />
<path
d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4z" />
</svg>
<span bsDatepickerDisplay>Select date</span>
</button>
<button
type="button"
bsButton="outline"
theme="secondary"
bsDatepicker
selectionMode="range"
[dateFormat]="short"
[(value)]="period">
<svg width="16" height="16" fill="currentColor" viewBox="0 0 16 16" aria-hidden="true">
<path
d="M11 6.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm-5 3a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5z" />
<path
d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4z" />
</svg>
<span bsDatepickerDisplay>Last 7 days</span>
</button>
</div>Inline mode
Use bsCalendar for an always-visible calendar. It takes the same options and binds to forms the same way.
Value: none
<div class="d-flex flex-wrap gap-5">
<div>
<div bsCalendar [(value)]="date"></div>
<p class="mt-3 mb-0 fg-3">Value: {{ date() ?? 'none' }}</p>
</div>
<div bsCalendar selectionMode="range" monthsCount="2" [(value)]="range"></div>
</div>Dark mode
The calendar is rendered next to its input, so it follows the surrounding color mode. Set colorMode to force one for the calendar only.
<div class="d-flex flex-wrap gap-3">
<div data-bs-theme="dark" class="p-3 bg-body fg-body rounded">
<label bsFormLabel for="datepickerDark">Dark mode datepicker</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerDark"
autocomplete="off"
placeholder="Select a date" />
</div>
<div class="p-3">
<label bsFormLabel for="datepickerDarkOnly">Dark calendar only</label>
<input
type="text"
bsFormControl
bsDatepicker
id="datepickerDarkOnly"
autocomplete="off"
colorMode="dark"
placeholder="Select a date" />
</div>
</div>Accessibility
The trigger has aria-haspopup="dialog" and aria-expanded, and the popup is a labeled dialog. Dates form an ARIA grid with one date in the tab order: ← → move by day, ↑ ↓ by week, Home and End to the start and end of the week, Page Up and Page Down by month, and with Shift by year. Each date is labeled with its full date, today has aria-current="date", and the month heading is announced when it changes. The month and year buttons in the header are described as “Choose month” and “Choose year”, and move focus into a grid of months or years that works the same way: arrow keys move by one and by row, Home and End to the start and end of the row, and Page Up and Page Down by a year or a page of years. Enter picks one and Escape returns to the days, without closing the popup.
<div bsCalendar locale="en-US" min="2026-06-05" value="2026-06-10"></div>API
BsDatepicker
Selector: input[bsDatepicker], button[bsDatepicker] · Exported as: bsDatepicker
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
value | BsDateValue | null | ISO date, or an array of them with multiple and range. Supports [(value)]. |
selectionMode | 'single' | 'multiple' | 'range' | 'single' | How dates are selected. |
min | string | null | null | Earliest selectable date, as YYYY-MM-DD. |
max | string | null | null | Latest selectable date, as YYYY-MM-DD. |
dateDisabled | ((iso: string) => boolean) | null | null | Returns true for dates that can’t be selected. |
firstWeekday | number | 1 | First day of the week: 0 for Sunday, 1 for Monday. |
monthsCount | number | 1 | Number of months shown side by side. |
weekNumbers | boolean | false | Shows the week numbers before each week. |
weekNumbering | 'iso' | 'simple' | 'iso' | How weeks are numbered: ISO 8601, or from the week holding 1 January. |
wareki | boolean | false | Shows years as Japanese era years, such as 令和8年(2026). |
locale | string | undefined | LOCALE_ID | Locale for dates and month and day names. Set undefined to use the browser’s language. |
colorMode | 'light' | 'dark' | null | null | Forces a color mode for the calendar. |
dateFormat | Intl.DateTimeFormatOptions | ((date, locale) => string) | null | null | How dates are shown. Inputs show ISO dates by default, buttons the locale’s medium date. |
dateParser | ((text, locale) => string | null) | null | null | Reads a typed date as YYYY-MM-DD, or returns null to fall back to the built-in parsing. |
invalidBehavior | 'revert' | 'keep' | 'revert' | What happens to typed text that isn’t accepted: put back, or kept with a bsDate form error. |
placement | BsPlacement | 'bottom-start' | Where the calendar opens. |
calendarLabel | string | 'Choose date' | Accessible name of the calendar popup. |
size | 'sm' | 'md' | 'lg' | 'md' | Size of an input: adds .form-control-sm or .form-control-lg. |
open | boolean | false | Opens the calendar. |
disabled | boolean | false | Disables the control. Forms also disable it through the form control. |
Outputs
| Name | Type | Description |
|---|---|---|
valueChange | BsDateValue | Emits the value when the user picks or types dates. |
openChange | boolean | Emits when the calendar opens or closes. |
textInvalid | BsDateTextInvalid | Emits typed text that isn’t accepted, with the reason: 'parse', 'out-of-range', 'disabled' or 'count'. |
Methods
| Name | Type | Description |
|---|---|---|
show() / hide() / toggle() | void | Opens or closes the calendar. |
focusCalendar() | void | Opens the calendar and moves focus into it. |
isOpen | Signal<boolean> | Whether the calendar is open. |
display | Signal<string> | The selected dates as text. |
textError | Signal<'parse' | 'out-of-range' | 'disabled' | 'count' | null> | Why the text kept with invalidBehavior="keep" isn’t accepted, or null while it is. |
BsDatepickerDisplay
Selector: [bsDatepickerDisplay]
BsCalendar
Selector: [bsCalendar] · Exported as: bsCalendar
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
value | BsDateValue | null | ISO date, or an array of them with multiple and range. Supports [(value)]. |
selectionMode | 'single' | 'multiple' | 'range' | 'single' | How dates are selected. |
min | string | null | null | Earliest selectable date, as YYYY-MM-DD. |
max | string | null | null | Latest selectable date, as YYYY-MM-DD. |
dateDisabled | ((iso: string) => boolean) | null | null | Returns true for dates that can’t be selected. |
firstWeekday | number | 1 | First day of the week: 0 for Sunday, 1 for Monday. |
monthsCount | number | 1 | Number of months shown side by side. |
weekNumbers | boolean | false | Shows the week numbers before each week. |
weekNumbering | 'iso' | 'simple' | 'iso' | How weeks are numbered: ISO 8601, or from the week holding 1 January. |
wareki | boolean | false | Shows years as Japanese era years, such as 令和8年(2026). |
locale | string | undefined | LOCALE_ID | Locale for dates and month and day names. Set undefined to use the browser’s language. |
colorMode | 'light' | 'dark' | null | null | Forces a color mode for the calendar. |
prevLabel | string | 'Previous month' | Accessible name of the previous month button. |
nextLabel | string | 'Next month' | Accessible name of the next month button. |
hideOutsideDays | boolean | false | Hides the neighboring months’ days. Always hidden with several months. |
weekLabel | string | 'Week' | Accessible name of the week numbers column. |
monthSelection | boolean | true | Makes the month in the header a button that shows the months to pick from. |
yearSelection | boolean | true | Makes the year in the header a button that shows the years to pick from. |
monthSelectionLabel | string | 'Choose month' | Description of the month button in the header. |
yearSelectionLabel | string | 'Choose year' | Description of the year button in the header. |
prevYearsLabel | string | 'Previous years' | Accessible name of the previous button while years are shown. |
nextYearsLabel | string | 'Next years' | Accessible name of the next button while years are shown. |
disabled | boolean | false | Disables the control. Forms also disable it through the form control. |
Outputs
| Name | Type | Description |
|---|---|---|
valueChange | BsDateValue | Emits the value when the user picks a date. |
selectionComplete | BsDateValue | Emits when a date, or a range’s end date, is picked. |
Methods
| Name | Type | Description |
|---|---|---|
focus() | void | Moves focus to the selected date or today. |
isDateDisabled(iso) | boolean | Whether a date is outside min and max or disabled. |
Date helpers
Import from: bootstrap-ng or bootstrap-ng/calendar
Functions
| Name | Type | Description |
|---|---|---|
parseIsoDate(value) | Date | null | Parses an ISO date (YYYY-MM-DD) as a local date. Returns null for other text and for dates that don’t exist, such as 2026-02-30. |
toIsoDate(year, month, day) | string | Returns the ISO date of a local date. The month counts from 0 like Date, and overflowing months and days roll over. |
selectedDates(value) | string[] | Returns the valid dates of a BsDateValue as an array, for single, multiple and range values alike. |
weekNumber(weekStart, firstWeekday?, numbering?) | number | Returns the week number shown for a week starting on the weekStart date. firstWeekday defaults to 1 (Monday) and numbering to 'iso', like the weekNumbers option. |