@vaadin/date-picker 25.3.0-dev.1fa5a51482 → 25.3.0-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,21 +3,88 @@
3
3
  * Copyright (c) 2016 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import type { DateMetadataController } from './vaadin-date-metadata-controller.js';
6
7
  import type { DatePickerDate } from './vaadin-date-picker-mixin.js';
7
8
 
9
+ /**
10
+ * Create a date at midnight in local time. Unlike `new Date(year, month, day)`,
11
+ * this supports years below 100, which the constructor maps into the 20th
12
+ * century. The month is assigned before the day so that the initial day of month
13
+ * (1) always exists in the target month.
14
+ *
15
+ * @param month Zero-based month, may be out of range to shift the year
16
+ * @param day May be `0` to select the last day of the previous month
17
+ */
18
+ declare function createDate(year: number, month: number, day: number): Date;
19
+
20
+ /**
21
+ * Get the first day of the month the given date is in.
22
+ */
23
+ declare function firstOfMonth(date: Date): Date;
24
+
25
+ /**
26
+ * Get the last day of the month the given date is in.
27
+ */
28
+ declare function lastOfMonth(date: Date): Date;
29
+
30
+ /**
31
+ * Get the index of a month, counted from January of year 0. Reduces a month to a single
32
+ * integer, so a lookup builds no key and two months are adjacent when their indexes are.
33
+ *
34
+ * @param month Zero-based month
35
+ */
36
+ declare function monthIndexOf(year: number, month: number): number;
37
+
38
+ /**
39
+ * Get the index of the month the given date is in.
40
+ */
41
+ declare function monthIndex(date: Date): number;
42
+
43
+ /**
44
+ * Get the first day of the month with the given index, inverting `monthIndexOf`. Counting from
45
+ * January of year 0 also inverts negative indexes, since `createDate` normalizes a month outside
46
+ * 0-11 into the year.
47
+ */
48
+ declare function monthDate(index: number): Date;
49
+
8
50
  /**
9
51
  * Get ISO 8601 week number for the given date.
10
52
  *
11
53
  * @returns Week number
12
54
  */
13
- declare function getISOWeekNumber(Date: Date): number;
55
+ declare function getISOWeekNumber(date: Date): number;
56
+
57
+ /**
58
+ * Creates a new object with the same date, but sets the hours, minutes, seconds and milliseconds to 0.
59
+ *
60
+ * @param date in system timezone
61
+ * @returns The same date with time elements set to 0, in system timezone.
62
+ */
63
+ declare function normalizeDate(date: Date): Date;
64
+
65
+ /**
66
+ * Creates a new object with the same date, but sets the hours, minutes, seconds and milliseconds to 0.
67
+ *
68
+ * Uses UTC date components to allow handling date instances independently of
69
+ * the system time-zone.
70
+ *
71
+ * @param date in UTC timezone
72
+ * @returns The same date with time elements set to 0, in UTC timezone.
73
+ */
74
+ declare function normalizeUTCDate(date: Date): Date;
14
75
 
15
76
  /**
16
77
  * Check if two dates are equal.
17
78
  *
18
79
  * @returns True if the given date objects refer to the same date
19
80
  */
20
- declare function dateEquals(date1: Date | null, date2: Date | null): boolean;
81
+ declare function dateEquals(date1: Date | null, date2: Date | null, normalizer?: (date: Date) => Date): boolean;
82
+
83
+ /**
84
+ * Extracts the basic component parts of a date (day, month and year)
85
+ * to the expected format.
86
+ */
87
+ declare function extractDateParts(date: Date): { day: number; month: number; year: number };
21
88
 
22
89
  /**
23
90
  * Check if the given date is in the range of allowed dates.
@@ -31,6 +98,21 @@ declare function dateAllowed(
31
98
  isDateDisabled: (date: DatePickerDate) => boolean | null,
32
99
  ): boolean;
33
100
 
101
+ /**
102
+ * Check if the given date can be selected: allowed by `dateAllowed` and not reported as disabled
103
+ * by the date metadata controller. This is narrower than `dateAllowed`, which decides what can be
104
+ * focused: a disabled date is still focusable, it just cannot be selected.
105
+ *
106
+ * @returns True if the date can be selected
107
+ */
108
+ declare function dateSelectable(
109
+ date: Date,
110
+ min: Date | null,
111
+ max: Date | null,
112
+ isDateDisabled: (date: DatePickerDate) => boolean | null,
113
+ controller?: DateMetadataController | null,
114
+ ): boolean;
115
+
34
116
  /**
35
117
  * Get closest date from array of dates.
36
118
  *
@@ -39,36 +121,85 @@ declare function dateAllowed(
39
121
  declare function getClosestDate(date: Date, dates: Date[]): Date;
40
122
 
41
123
  /**
42
- * Extracts the basic component parts of a date (day, month and year)
43
- * to the expected format.
124
+ * Get difference in months between today and given months value.
44
125
  */
45
- declare function extractDateParts(date: Date): { day: number; month: number; year: number };
126
+ declare function dateAfterXMonths(months: number): Date;
46
127
 
47
128
  /**
48
- * Get difference in months between today and given months value.
129
+ * Calculate the year of the date based on the provided reference date.
130
+ * Gets a two-digit year and returns a full year.
131
+ *
132
+ * @param year Should be in the range of [0, 99]
133
+ * @returns Adjusted year value
49
134
  */
50
- declare function dateAfterXMonths(months: number): number;
135
+ declare function getAdjustedYear(referenceDate: Date, year: number, month?: number, day?: number): number;
51
136
 
52
137
  /**
53
- * Calculate the year of the date based on the provided reference date
54
- * Gets a two-digit year and returns a full year.
138
+ * Parse date string of one of the following date formats:
139
+ * - ISO 8601 `"YYYY-MM-DD"`
140
+ * - Extended ISO 8601 with a signed year, e.g. `"+012026-MM-DD"` or `"-0001-MM-DD"`
141
+ *
142
+ * A date that does not exist, such as `"2026-02-30"`, is not parsed. Building it would carry the
143
+ * surplus into the next month or year and answer with a date that was never asked for.
144
+ *
145
+ * @param str Date string to parse
146
+ * @returns Parsed date in system timezone, or `undefined` when the string is not a date
55
147
  */
56
- declare function getAdjustedYear(referenceDate: Date, year: number, month?: number, day?: number): Date;
148
+ declare function parseDate(str: string): Date | undefined;
57
149
 
58
150
  /**
59
151
  * Parse date string of one of the following date formats:
60
152
  * - ISO 8601 `"YYYY-MM-DD"`
61
- * - 6-digit extended ISO 8601 `"+YYYYYY-MM-DD"`, `"-YYYYYY-MM-DD"`
153
+ * - Extended ISO 8601 with a signed year, e.g. `"+012026-MM-DD"` or `"-0001-MM-DD"`
154
+ *
155
+ * Uses UTC date components to allow handling date instances independently of
156
+ * the system time-zone.
157
+ *
158
+ * A date that does not exist, such as `"2026-02-30"`, is not parsed, as in `parseDate`.
159
+ *
160
+ * @param str Date string to parse
161
+ * @returns Parsed date in UTC timezone, or `undefined` when the string is not a date
62
162
  */
63
- declare function parseDate(str: string): Date;
163
+ declare function parseUTCDate(str: string): Date | undefined;
164
+
165
+ /**
166
+ * Format a date instance in ISO 8601 (`"YYYY-MM-DD"`) or 6-digit extended ISO
167
+ * 8601 (`"+YYYYYY-MM-DD"`, `"-YYYYYY-MM-DD"`) format.
168
+ *
169
+ * @param date in system timezone
170
+ */
171
+ declare function formatISODate(date: Date): string;
172
+
173
+ /**
174
+ * Format a date instance in ISO 8601 (`"YYYY-MM-DD"`) or 6-digit extended ISO
175
+ * 8601 (`"+YYYYYY-MM-DD"`, `"-YYYYYY-MM-DD"`) format.
176
+ *
177
+ * Uses UTC date components to allow handling date instances independently of
178
+ * the system time-zone.
179
+ *
180
+ * @param date in UTC timezone
181
+ */
182
+ declare function formatUTCISODate(date: Date): string;
64
183
 
65
184
  export {
185
+ createDate,
186
+ firstOfMonth,
187
+ lastOfMonth,
188
+ monthIndexOf,
189
+ monthIndex,
190
+ monthDate,
66
191
  getISOWeekNumber,
192
+ normalizeDate,
193
+ normalizeUTCDate,
67
194
  dateEquals,
195
+ extractDateParts,
68
196
  dateAllowed,
197
+ dateSelectable,
69
198
  getClosestDate,
70
- extractDateParts,
71
199
  dateAfterXMonths,
72
200
  getAdjustedYear,
73
201
  parseDate,
202
+ parseUTCDate,
203
+ formatISODate,
204
+ formatUTCISODate,
74
205
  };
@@ -4,6 +4,79 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
7
+ /**
8
+ * Create a date at midnight in local time. Unlike `new Date(year, month, day)`,
9
+ * this supports years below 100, which the constructor maps into the 20th
10
+ * century. The month is assigned before the day so that the initial day of month
11
+ * (1) always exists in the target month.
12
+ *
13
+ * @param {number} year
14
+ * @param {number} month Zero-based month, may be out of range to shift the year
15
+ * @param {number} day May be `0` to select the last day of the previous month
16
+ * @return {Date}
17
+ */
18
+ export function createDate(year, month, day) {
19
+ const date = new Date(0, 0); // Wrong date (1900-01-01), but with midnight in local time
20
+ date.setFullYear(year);
21
+ date.setMonth(month);
22
+ date.setDate(day);
23
+ return date;
24
+ }
25
+
26
+ /**
27
+ * Get the first day of the month the given date is in.
28
+ *
29
+ * @param {!Date} date
30
+ * @return {Date}
31
+ */
32
+ export function firstOfMonth(date) {
33
+ return createDate(date.getFullYear(), date.getMonth(), 1);
34
+ }
35
+
36
+ /**
37
+ * Get the last day of the month the given date is in.
38
+ *
39
+ * @param {!Date} date
40
+ * @return {Date}
41
+ */
42
+ export function lastOfMonth(date) {
43
+ return createDate(date.getFullYear(), date.getMonth() + 1, 0);
44
+ }
45
+
46
+ /**
47
+ * Get the index of a month, counted from January of year 0. Reduces a month to a single
48
+ * integer, so a lookup builds no key and two months are adjacent when their indexes are.
49
+ *
50
+ * @param {number} year
51
+ * @param {number} month Zero-based month
52
+ * @return {number}
53
+ */
54
+ export function monthIndexOf(year, month) {
55
+ return year * 12 + month;
56
+ }
57
+
58
+ /**
59
+ * Get the index of the month the given date is in.
60
+ *
61
+ * @param {!Date} date
62
+ * @return {number}
63
+ */
64
+ export function monthIndex(date) {
65
+ return monthIndexOf(date.getFullYear(), date.getMonth());
66
+ }
67
+
68
+ /**
69
+ * Get the first day of the month with the given index, inverting `monthIndexOf`. Counting from
70
+ * January of year 0 also inverts negative indexes, since `createDate` normalizes a month outside
71
+ * 0-11 into the year.
72
+ *
73
+ * @param {number} index
74
+ * @return {Date}
75
+ */
76
+ export function monthDate(index) {
77
+ return createDate(0, index, 1);
78
+ }
79
+
7
80
  /**
8
81
  * Get ISO 8601 week number for the given date.
9
82
  *
@@ -106,6 +179,22 @@ export function dateAllowed(date, min, max, isDateDisabled) {
106
179
  return (!min || date >= min) && (!max || date <= max) && !dateIsDisabled;
107
180
  }
108
181
 
182
+ /**
183
+ * Check if the given date can be selected: allowed by `dateAllowed` and not reported as disabled
184
+ * by the date metadata controller. This is narrower than `dateAllowed`, which decides what can be
185
+ * focused: a disabled date is still focusable, it just cannot be selected.
186
+ *
187
+ * @param {!Date} date The date to check
188
+ * @param {Date | null} min Range start
189
+ * @param {Date | null} max Range end
190
+ * @param {function(!DatePickerDate): boolean} isDateDisabled Callback to check if the date is disabled
191
+ * @param {DateMetadataController | null} [controller] The date metadata controller
192
+ * @return {boolean} True if the date can be selected
193
+ */
194
+ export function dateSelectable(date, min, max, isDateDisabled, controller) {
195
+ return dateAllowed(date, min, max, isDateDisabled) && !controller?.isDateDisabled(date);
196
+ }
197
+
109
198
  /**
110
199
  * Get closest date from array of dates.
111
200
  *
@@ -171,51 +260,66 @@ export function getAdjustedYear(referenceDate, year, month = 0, day = 1) {
171
260
  return adjustedYear;
172
261
  }
173
262
 
263
+ const ISO_DATE = /^([-+]\d{1,6}|\d{2,4})-(\d{1,2})-(\d{1,2})$/u;
264
+
265
+ // The parts of a date string in a format the parsers accept, as written.
266
+ function parseParts(str) {
267
+ // Parsing with RegExp to ensure correct format
268
+ const parts = ISO_DATE.exec(str);
269
+ if (!parts) {
270
+ return undefined;
271
+ }
272
+
273
+ return { year: parseInt(parts[1], 10), month: parseInt(parts[2], 10) - 1, day: parseInt(parts[3], 10) };
274
+ }
275
+
174
276
  /**
175
277
  * Parse date string of one of the following date formats:
176
278
  * - ISO 8601 `"YYYY-MM-DD"`
177
- * - 6-digit extended ISO 8601 `"+YYYYYY-MM-DD"`, `"-YYYYYY-MM-DD"`
279
+ * - Extended ISO 8601 with a signed year, e.g. `"+012026-MM-DD"` or `"-0001-MM-DD"`
280
+ *
281
+ * A date that does not exist, such as `"2026-02-30"`, is not parsed. Building it would carry the
282
+ * surplus into the next month or year and answer with a date that was never asked for.
283
+ *
178
284
  * @param {!string} str Date string to parse
179
285
  * @return {Date} Parsed date in system timezone
180
286
  */
181
287
  export function parseDate(str) {
182
- // Parsing with RegExp to ensure correct format
183
- const parts = /^([-+]\d{1}|\d{2,4}|[-+]\d{6})-(\d{1,2})-(\d{1,2})$/u.exec(str);
288
+ const parts = parseParts(str);
184
289
  if (!parts) {
185
290
  return undefined;
186
291
  }
187
292
 
188
- const date = new Date(0, 0); // Wrong date (1900-01-01), but with midnight in local time
189
- date.setFullYear(parseInt(parts[1], 10));
190
- date.setMonth(parseInt(parts[2], 10) - 1);
191
- date.setDate(parseInt(parts[3], 10));
192
- return date;
293
+ const date = createDate(parts.year, parts.month, parts.day);
294
+
295
+ return date.getMonth() === parts.month && date.getDate() === parts.day ? date : undefined;
193
296
  }
194
297
 
195
298
  /**
196
299
  * Parse date string of one of the following date formats:
197
300
  * - ISO 8601 `"YYYY-MM-DD"`
198
- * - 6-digit extended ISO 8601 `"+YYYYYY-MM-DD"`, `"-YYYYYY-MM-DD"`
301
+ * - Extended ISO 8601 with a signed year, e.g. `"+012026-MM-DD"` or `"-0001-MM-DD"`
199
302
  *
200
303
  * Uses UTC date components to allow handling date instances independently of
201
304
  * the system time-zone.
202
305
  *
306
+ * A date that does not exist, such as `"2026-02-30"`, is not parsed, as in `parseDate`.
307
+ *
203
308
  * @param {!string} str Date string to parse
204
309
  * @return {Date} Parsed date in UTC timezone
205
310
  */
206
311
  export function parseUTCDate(str) {
207
- // Parsing with RegExp to ensure correct format
208
- const parts = /^([-+]\d{1}|\d{2,4}|[-+]\d{6})-(\d{1,2})-(\d{1,2})$/u.exec(str);
312
+ const parts = parseParts(str);
209
313
  if (!parts) {
210
314
  return undefined;
211
315
  }
212
316
 
213
317
  const date = new Date(Date.UTC(0, 0)); // Wrong date (1900-01-01), but with midnight in UTC
214
- date.setUTCFullYear(parseInt(parts[1], 10));
215
- date.setUTCMonth(parseInt(parts[2], 10) - 1);
216
- date.setUTCDate(parseInt(parts[3], 10));
318
+ date.setUTCFullYear(parts.year);
319
+ date.setUTCMonth(parts.month);
320
+ date.setUTCDate(parts.day);
217
321
 
218
- return date;
322
+ return date.getUTCMonth() === parts.month && date.getUTCDate() === parts.day ? date : undefined;
219
323
  }
220
324
 
221
325
  function formatISODateBase(dateParts) {
@@ -18,34 +18,49 @@ export interface DatePickerDate {
18
18
  year: number;
19
19
  }
20
20
 
21
+ /**
22
+ * A range of dates that `dateMetadataProvider` is asked about.
23
+ * It can span several months and always covers whole months.
24
+ */
21
25
  export interface DatePickerDateRange {
22
26
  /**
23
- * The first date of the range (inclusive).
27
+ * The first date of the range (inclusive), as an ISO 8601 date.
24
28
  */
25
- start: DatePickerDate;
29
+ start: string;
26
30
  /**
27
- * The last date of the range (inclusive).
31
+ * The last date of the range (inclusive), as an ISO 8601 date.
28
32
  */
29
- end: DatePickerDate;
33
+ end: string;
30
34
  }
31
35
 
32
36
  /**
33
- * Metadata resolved on demand for a single date by `dateMetadataProvider`. Extends
34
- * `DatePickerDate` with the date's metadata. Extra fields can be added and used by the
35
- * synchronous generators (e.g. `isDateDisabled`) as context.
37
+ * Metadata for a single date, returned by `dateMetadataProvider`.
36
38
  */
37
- export interface DatePickerDateMetadata extends DatePickerDate {
39
+ export interface DatePickerDateMetadata {
40
+ /**
41
+ * The date the metadata applies to in ISO 8601 format.
42
+ */
43
+ date: string;
38
44
  /**
39
45
  * Whether the date cannot be selected.
40
46
  */
41
47
  disabled?: boolean;
42
48
  /**
43
- * Custom part name(s) added to the date cell's `part` attribute, so a theme can style the
44
- * date via `::part()`. Either a single name or several separated by spaces.
49
+ * Part names to add to the date, so a theme can style it with `::part()`. A single name, or
50
+ * several separated by spaces. Do not use built-in names like `disabled` and `selected`.
45
51
  */
46
52
  part?: string;
47
53
  }
48
54
 
55
+ /**
56
+ * A function called with the range of dates the calendar is about to render, returning
57
+ * the metadata for the dates in that range. It can return a `Promise` to load the metadata
58
+ * asynchronously, and `null` or `undefined` when no date in the range has metadata.
59
+ */
60
+ export type DatePickerDateMetadataProvider = (
61
+ range: DatePickerDateRange,
62
+ ) => DatePickerDateMetadata[] | Promise<DatePickerDateMetadata[] | null | undefined> | null | undefined;
63
+
49
64
  export interface DatePickerI18n {
50
65
  /**
51
66
  * An array with the full names of months starting
@@ -75,6 +90,11 @@ export interface DatePickerI18n {
75
90
  * Translation of the Cancel button text.
76
91
  */
77
92
  cancel?: string;
93
+ /**
94
+ * Accessible name of the overlay content, announced by screen readers when
95
+ * the overlay opens.
96
+ */
97
+ dialogAccessibleName?: string;
78
98
  /**
79
99
  * Used for adjusting the year value when parsing dates with short years.
80
100
  * The year values between 0 and 99 are evaluated and adjusted.
@@ -202,6 +222,10 @@ export declare class DatePickerMixinClass {
202
222
  * // Translation of the Cancel button text.
203
223
  * cancel: 'Cancel',
204
224
  *
225
+ * // Accessible name of the overlay content, announced by screen readers
226
+ * // when the overlay opens.
227
+ * dialogAccessibleName: 'Calendar',
228
+ *
205
229
  * // Used for adjusting the year value when parsing dates with short years.
206
230
  * // The year values between 0 and 99 are evaluated and adjusted.
207
231
  * // Example: for a referenceDate of 1970-10-30;
@@ -261,33 +285,51 @@ export declare class DatePickerMixinClass {
261
285
  * A function to be used to determine whether the user can select a given date.
262
286
  * Receives a `DatePickerDate` object of the date to be selected and should return a
263
287
  * boolean.
288
+ *
289
+ * The function is called once per date and has to answer synchronously. Use
290
+ * `dateMetadataProvider` when the answer has to be loaded first, or when dates also need
291
+ * custom part names. A date is disabled when either of the two disables it.
264
292
  */
265
293
  isDateDisabled: (date: DatePickerDate) => boolean;
266
294
 
267
295
  /**
268
- * A batch function that fetches metadata for a range of dates the calendar is about to render.
269
- * It receives a `DatePickerDateRange` object and returns, or resolves with, an array of
270
- * `DatePickerDateMetadata` objects (a `DatePickerDate` extended with metadata such as
271
- * `disabled` and custom `part` names) for the dates that have metadata within that range.
296
+ * A function that provides metadata for the dates the calendar is about to render: whether they
297
+ * are disabled, and CSS `part` names for styling from outside using the `::part()` selector.
298
+ * Unlike `isDateDisabled`, which is called once per date, the metadata provider is called for
299
+ * a range of dates at a time, and again as the calendar renders further dates.
300
+ *
301
+ * It receives a `DatePickerDateRange` and returns an array of `DatePickerDateMetadata` objects
302
+ * for the dates in that range that have metadata. It can return a `Promise` to load the metadata
303
+ * asynchronously, and `null` or `undefined` when no date in the range has metadata.
304
+ *
305
+ * The returned array has the following structure:
306
+ *
307
+ * ```js
308
+ * [
309
+ * // The date is an ISO 8601 string.
310
+ * { date: '2026-01-01', disabled: true },
311
+ *
312
+ * // Adds a custom part name to the date.
313
+ * { date: '2026-01-02', part: 'busy' },
314
+ * ]
315
+ * ```
272
316
  *
273
- * Unlike `isDateDisabled`, which is called once per date, this function is called for a range
274
- * of dates at a time, and again as the calendar renders further dates. The size of the range
275
- * is decided by the calendar and may span multiple months. It may return a `Promise`, in which
276
- * case the affected dates render in a non-selectable pending state until it resolves.
317
+ * A date is disabled if its metadata marks it disabled, or `isDateDisabled` returns `true`, or
318
+ * it is outside `min` and `max`. Disabled dates are not selectable, and typing a disabled date in
319
+ * the field makes it invalid. The provider does not affect which date is focused when opening the
320
+ * overlay. Use `initialPosition` property to provide a selectable date.
277
321
  *
278
- * `disabled` from the metadata is combined with `min`, `max` and `isDateDisabled`: a date is
279
- * disabled if it is out of range, or `isDateDisabled` returns `true`, or its metadata marks it
280
- * disabled. `part` names are added to the date cell so a theme can style it via `::part()`.
322
+ * While a returned `Promise` is pending, the dates it covers are not disabled yet and render with
323
+ * the `loading` part. If the function throws or rejects, corresponding dates are requested again
324
+ * the next time the user navigates.
281
325
  *
282
- * Both `disabled` and `part` are returned by this one function, rather than by separate
283
- * generators, so a single backend query (for example in Flow) can answer both at once instead
284
- * of being split into two passes over the same data.
326
+ * The provider is used for validation also when the overlay is closed. Date is considered valid
327
+ * while the provider is pending, and is re-validated again after the metadata is loaded.
285
328
  *
286
- * Keep a stable reference to the function. Assigning a new function resets the internal cache
287
- * and re-fetches every visible range. To reload after the underlying data changes while keeping
288
- * the same function, call `clearCache()`.
329
+ * Keep a stable reference to the function: assigning a new one clears the cache and re-fetches
330
+ * visible range. Call `clearCache()` to re-fetch when the data behind the same function changed.
289
331
  */
290
- dateMetadataProvider: (range: DatePickerDateRange) => DatePickerDateMetadata[] | Promise<DatePickerDateMetadata[]>;
332
+ dateMetadataProvider: DatePickerDateMetadataProvider | null | undefined;
291
333
 
292
334
  /**
293
335
  * Opens the dropdown.
@@ -300,9 +342,7 @@ export declare class DatePickerMixinClass {
300
342
  close(): void;
301
343
 
302
344
  /**
303
- * Clears the cached date metadata and reloads it from `dateMetadataProvider`. Call this when the
304
- * data behind the provider has changed (for example a date became booked) so the calendar
305
- * reflects it, without having to replace the provider function.
345
+ * Clears the `dateMetadataProvider` cache and reloads the date metadata.
306
346
  */
307
347
  clearCache(): void;
308
348
  }