@@ -230,12 +230,56 @@ fit the width of the parent element. The `width` prop has no effect when `block`
230
230
Note it is _not recommended_ to set a width below `260px`, otherwise truncation and layout issues
231
231
with the component may occur.
232
232
233
+
### Date string format
234
+
235
+
<span class="badge badge-info small">v2.6.0+</span>
236
+
237
+
To change format options of the displayed date text inside the component, e.g. in the header, set
238
+
the `dateFormatOptions` prop to an object containing the requested format properties for the
239
+
`Intl.DateTimeFormat` object (see also [Internationalization](#internationalization)).
240
+
241
+
```html
242
+
<template>
243
+
<div>
244
+
<p>Custom date format:</p>
245
+
<b-calendar
246
+
:dateFormatOptions="{ year: 'numeric', month: 'short', day: '2-digit', weekday: 'short' }"
247
+
locale="en"
248
+
></b-calendar>
249
+
<p class="mt-3">Short date format:</p>
250
+
<b-calendar
251
+
:dateFormatOptions="{ year: 'numeric', month: 'numeric', day: 'numeric' }"
252
+
locale="en"
253
+
></b-calendar>
254
+
</div>
255
+
</template>
256
+
257
+
<!-- b-calendar-dateformat.vue -->
258
+
```
259
+
260
+
The following table summarizes the valid options for each format property:
261
+
262
+
| Property | Possible values |
263
+
| --------- | ------------------------------------------------------------ |
264
+
| `year` | `'numeric'`, or `'2-digit'` |
265
+
| `month` | `'numeric'`, `'2-digit'`, `'long'`, `'short'`, or `'narrow'` |
266
+
| `day` | `'numeric'`, or `'2-digit'` |
267
+
| `weekday` | `'long'`, `'short'`, or `'narrow'` |
268
+
269
+
Notes:
270
+
271
+
- Leaving out certain options may affect the formatted text string, e.g. the `weekday`
272
+
- The formatted value will vary according to the resolved locale. Some locales may not support the
273
+
`'narrow'` format and will fall back to `'short'` or `long'` (if `'short'` is not available)
274
+
- `year`, `month` and `day` will always be shown. If you need to leave out a value, set the property
275
+
to `undefined`, although this is highly discouraged for accessibility reasons
276
+
233
277
### Hiding the top selected date header
234
278
235
279
By default, the current selected date will be displayed at the top of the calendar component,
236
280
formatted in the locale's language.
237
281
238
-
You can hide this header via the `hide-header` prop. Note this only visually hides the selected
282
+
You can hide this header via the `hide-header` prop. Note this only _visually hides_ the selected
239
283
date, while keeping it available to screen reader users as an `aria-live` region.
240
284
241
285
### Border and padding
@@ -400,7 +444,7 @@ properties:
400
444
| `selectedFormatted` | The selected date formatted in the current locale. If no date is selected, this will be the value of the `label-no-date-selected` prop |
401
445
| `activeYMD` | The current date of the calendar day button that can receive focus as a string (`YYYY-MM-DD` format) |
402
446
| `activeDate` | The current date of the calendar day button that can receive focus as a `Date` object |
403
-
| `activeFormated` | The active date formatted in the current locale |
447
+
| `activeFormatted` | The active date formatted in the current locale |
404
448
| `disabled` | Will be `true` if active date is disabled, `false` otherwise |
405
449
| `locale` | The resolved locale (may not be the same as the requested locale) |
406
450
| `calendarLocale` | The resolved locale used by the calendar, optionally including the calendar type (i.e. 'gregory'). Usually this will be the same as `locale`, but may include the calendar type used, such as `fa-u-ca-gregory` when selecting the Persian locale (`'fa'`) |
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4