@ionic/core 8.8.12 → 8.8.13-nightly.20260626

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.
@@ -9,7 +9,7 @@ import { i as isRTL } from './dir-C53feagD.js';
9
9
  import { c as createColorClasses, g as getClassMap } from './theme-DiVJyqlX.js';
10
10
  import { l as chevronDown, o as caretUpSharp, p as chevronForward, q as caretDownSharp, c as chevronBack } from './index-DV3sJJW8.js';
11
11
  import { b as getIonMode } from './ionic-global-Cp_eT4sZ.js';
12
- import { i as isBefore, a as isAfter, g as getPreviousMonth, b as getNextMonth, c as isSameDay, d as getDay, e as generateDayAriaLabel, v as validateParts, f as getPartsFromCalendarDay, h as getNextYear, j as getPreviousYear, k as getEndOfWeek, l as getStartOfWeek, m as getPreviousDay, n as getNextDay, o as getPreviousWeek, p as getNextWeek, q as parseMinParts, r as parseMaxParts, s as parseDate, w as warnIfValueOutOfBounds, t as parseAmPm, u as clampDate, x as convertToArrayOfNumbers, y as convertDataToISO, z as getToday, A as getClosestValidDate, B as generateMonths, C as getNumDaysInMonth, D as getCombinedDateColumnData, E as getMonthColumnData, F as getDayColumnData, G as getYearColumnData, H as isMonthFirstLocale, I as getTimeColumnsData, J as isLocaleDayPeriodRTL, K as calculateHourFromAMPM, L as getDaysOfWeek, M as getMonthAndYear, N as getDaysOfMonth, O as getHourCycle, P as getLocalizedTime, Q as getLocalizedDateTime, R as formatValue } from './data-DZI70dKr.js';
12
+ import { r as removeDateTzOffset, g as getNextMonth, a as getPreviousMonth, i as isSameDay, b as getTodayLabel, c as getYear, d as getHourCycle, e as getInternalHourValue, f as getFormattedHour, h as addTimePadding, j as getLocalizedDayPeriod, k as isBefore, l as isAfter, m as is24Hour, n as getNumDaysInMonth, o as getDay, p as generateDayAriaLabel, v as validateParts, q as getPartsFromCalendarDay, s as getNextYear, t as getPreviousYear, u as getEndOfWeek, w as getStartOfWeek, x as getPreviousDay, y as getNextDay, z as getPreviousWeek, A as getNextWeek, B as parseMinParts, C as parseMaxParts, D as parseDate, E as warnIfValueOutOfBounds, F as parseAmPm, G as clampDate, H as convertToArrayOfNumbers, I as convertDataToISO, J as getClosestValidDate, K as isMonthFirstLocale, L as isLocaleDayPeriodRTL, M as calculateHourFromAMPM, N as getMonthAndYear, O as getLocalizedTime, P as getLocalizedDateTime, Q as formatValue } from './format-CAmvpAez.js';
13
13
  import { c as createLockController } from './lock-controller-B-hirT0v.js';
14
14
  import { c as createAnimation } from './animation-DLJpuoEz.js';
15
15
  import { a as hapticSelectionChanged, h as hapticSelectionEnd, b as hapticSelectionStart } from './haptic-DzAMWJuk.js';
@@ -19,6 +19,529 @@ import './framework-delegate-FnPGymXL.js';
19
19
  import './gesture-controller-BTEOs1at.js';
20
20
  import './capacitor-CFERIeaU.js';
21
21
 
22
+ /**
23
+ * Returns the current date as
24
+ * an ISO string in the user's
25
+ * time zone.
26
+ */
27
+ const getToday = () => {
28
+ /**
29
+ * ion-datetime intentionally does not
30
+ * parse time zones/do automatic time zone
31
+ * conversion when accepting user input.
32
+ * However when we get today's date string,
33
+ * we want it formatted relative to the user's
34
+ * time zone.
35
+ *
36
+ * When calling toISOString(), the browser
37
+ * will convert the date to UTC time by either adding
38
+ * or subtracting the time zone offset.
39
+ * To work around this, we need to either add
40
+ * or subtract the time zone offset to the Date
41
+ * object prior to calling toISOString().
42
+ * This allows us to get an ISO string
43
+ * that is in the user's time zone.
44
+ */
45
+ return removeDateTzOffset(new Date()).toISOString();
46
+ };
47
+ const minutes = [
48
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
49
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
50
+ ];
51
+ // h11 hour system uses 0-11. Midnight starts at 0:00am.
52
+ const hour11 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
53
+ // h12 hour system uses 0-12. Midnight starts at 12:00am.
54
+ const hour12 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
55
+ // h23 hour system uses 0-23. Midnight starts at 0:00.
56
+ const hour23 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23];
57
+ // h24 hour system uses 1-24. Midnight starts at 24:00.
58
+ const hour24 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0];
59
+ /**
60
+ * Given a locale and a mode,
61
+ * return an array with formatted days
62
+ * of the week. iOS should display days
63
+ * such as "Mon" or "Tue".
64
+ * MD should display days such as "M"
65
+ * or "T".
66
+ */
67
+ const getDaysOfWeek = (locale, mode, firstDayOfWeek = 0) => {
68
+ /**
69
+ * Nov 1st, 2020 starts on a Sunday.
70
+ * ion-datetime assumes weeks start on Sunday,
71
+ * but is configurable via `firstDayOfWeek`.
72
+ */
73
+ const weekdayFormat = mode === 'ios' ? 'short' : 'narrow';
74
+ const intl = new Intl.DateTimeFormat(locale, { weekday: weekdayFormat });
75
+ const startDate = new Date('11/01/2020');
76
+ const daysOfWeek = [];
77
+ /**
78
+ * For each day of the week,
79
+ * get the day name.
80
+ */
81
+ for (let i = firstDayOfWeek; i < firstDayOfWeek + 7; i++) {
82
+ const currentDate = new Date(startDate);
83
+ currentDate.setDate(currentDate.getDate() + i);
84
+ daysOfWeek.push(intl.format(currentDate));
85
+ }
86
+ return daysOfWeek;
87
+ };
88
+ /**
89
+ * Returns an array containing all of the
90
+ * days in a month for a given year. Values are
91
+ * aligned with a week calendar starting on
92
+ * the firstDayOfWeek value (Sunday by default)
93
+ * using null values.
94
+ */
95
+ const getDaysOfMonth = (month, year, firstDayOfWeek, showAdjacentDays = false) => {
96
+ const numDays = getNumDaysInMonth(month, year);
97
+ let previousNumDays; //previous month number of days
98
+ if (month === 1) {
99
+ // If the current month is January, the previous month should be December of the previous year.
100
+ previousNumDays = getNumDaysInMonth(12, year - 1);
101
+ }
102
+ else {
103
+ // Otherwise, the previous month should be the current month - 1 of the same year.
104
+ previousNumDays = getNumDaysInMonth(month - 1, year);
105
+ }
106
+ const firstOfMonth = new Date(`${month}/1/${year}`).getDay();
107
+ /**
108
+ * To get the first day of the month aligned on the correct
109
+ * day of the week, we need to determine how many "filler" days
110
+ * to generate. These filler days as empty/disabled buttons
111
+ * that fill the space of the days of the week before the first
112
+ * of the month.
113
+ *
114
+ * There are two cases here:
115
+ *
116
+ * 1. If firstOfMonth = 4, firstDayOfWeek = 0 then the offset
117
+ * is (4 - (0 + 1)) = 3. Since the offset loop goes from 0 to 3 inclusive,
118
+ * this will generate 4 filler days (0, 1, 2, 3), and then day of week 4 will have
119
+ * the first day of the month.
120
+ *
121
+ * 2. If firstOfMonth = 2, firstDayOfWeek = 4 then the offset
122
+ * is (6 - (4 - 2)) = 4. Since the offset loop goes from 0 to 4 inclusive,
123
+ * this will generate 5 filler days (0, 1, 2, 3, 4), and then day of week 5 will have
124
+ * the first day of the month.
125
+ */
126
+ const offset = firstOfMonth >= firstDayOfWeek ? firstOfMonth - (firstDayOfWeek + 1) : 6 - (firstDayOfWeek - firstOfMonth);
127
+ let days = [];
128
+ for (let i = 1; i <= numDays; i++) {
129
+ days.push({ day: i, dayOfWeek: (offset + i) % 7, isAdjacentDay: false });
130
+ }
131
+ if (showAdjacentDays) {
132
+ for (let i = 0; i <= offset; i++) {
133
+ // Using offset create previous month adjacent day, starting from last day
134
+ days = [{ day: previousNumDays - i, dayOfWeek: (previousNumDays - i) % 7, isAdjacentDay: true }, ...days];
135
+ }
136
+ // Calculate positiveOffset
137
+ // The calendar will display 42 days (6 rows of 7 columns)
138
+ // Knowing this the offset is 41 (we start at index 0)
139
+ // minus (the previous offset + the current month days)
140
+ const positiveOffset = 41 - (numDays + offset);
141
+ for (let i = 0; i < positiveOffset; i++) {
142
+ days.push({ day: i + 1, dayOfWeek: (numDays + offset + i) % 7, isAdjacentDay: true });
143
+ }
144
+ }
145
+ else {
146
+ for (let i = 0; i <= offset; i++) {
147
+ days = [{ day: null, dayOfWeek: null, isAdjacentDay: false }, ...days];
148
+ }
149
+ }
150
+ return days;
151
+ };
152
+ /**
153
+ * Returns an array of pre-defined hour
154
+ * values based on the provided hourCycle.
155
+ */
156
+ const getHourData = (hourCycle) => {
157
+ switch (hourCycle) {
158
+ case 'h11':
159
+ return hour11;
160
+ case 'h12':
161
+ return hour12;
162
+ case 'h23':
163
+ return hour23;
164
+ case 'h24':
165
+ return hour24;
166
+ default:
167
+ throw new Error(`Invalid hour cycle "${hourCycle}"`);
168
+ }
169
+ };
170
+ /**
171
+ * Given a local, reference datetime parts and option
172
+ * max/min bound datetime parts, calculate the acceptable
173
+ * hour and minute values according to the bounds and locale.
174
+ */
175
+ const generateTime = (locale, refParts, hourCycle = 'h12', minParts, maxParts, hourValues, minuteValues) => {
176
+ const computedHourCycle = getHourCycle(locale, hourCycle);
177
+ const use24Hour = is24Hour(computedHourCycle);
178
+ let processedHours = getHourData(computedHourCycle);
179
+ let processedMinutes = minutes;
180
+ let isAMAllowed = true;
181
+ let isPMAllowed = true;
182
+ if (hourValues) {
183
+ processedHours = processedHours.filter((hour) => hourValues.includes(hour));
184
+ }
185
+ if (minuteValues) {
186
+ processedMinutes = processedMinutes.filter((minute) => minuteValues.includes(minute));
187
+ }
188
+ if (minParts) {
189
+ /**
190
+ * If ref day is the same as the
191
+ * minimum allowed day, filter hour/minute
192
+ * values according to min hour and minute.
193
+ */
194
+ if (isSameDay(refParts, minParts)) {
195
+ /**
196
+ * Users may not always set the hour/minute for
197
+ * min value (i.e. 2021-06-02) so we should allow
198
+ * all hours/minutes in that case.
199
+ */
200
+ if (minParts.hour !== undefined) {
201
+ processedHours = processedHours.filter((hour) => {
202
+ const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
203
+ return (use24Hour ? hour : convertedHour) >= minParts.hour;
204
+ });
205
+ isAMAllowed = minParts.hour < 13;
206
+ }
207
+ if (minParts.minute !== undefined) {
208
+ /**
209
+ * The minimum minute range should not be enforced when
210
+ * the hour is greater than the min hour.
211
+ *
212
+ * For example with a minimum range of 09:30, users
213
+ * should be able to select 10:00-10:29 and beyond.
214
+ */
215
+ let isPastMinHour = false;
216
+ if (minParts.hour !== undefined && refParts.hour !== undefined) {
217
+ if (refParts.hour > minParts.hour) {
218
+ isPastMinHour = true;
219
+ }
220
+ }
221
+ processedMinutes = processedMinutes.filter((minute) => {
222
+ if (isPastMinHour) {
223
+ return true;
224
+ }
225
+ return minute >= minParts.minute;
226
+ });
227
+ }
228
+ /**
229
+ * If ref day is before minimum
230
+ * day do not render any hours/minute values
231
+ */
232
+ }
233
+ else if (isBefore(refParts, minParts)) {
234
+ processedHours = [];
235
+ processedMinutes = [];
236
+ isAMAllowed = isPMAllowed = false;
237
+ }
238
+ }
239
+ if (maxParts) {
240
+ /**
241
+ * If ref day is the same as the
242
+ * maximum allowed day, filter hour/minute
243
+ * values according to max hour and minute.
244
+ */
245
+ if (isSameDay(refParts, maxParts)) {
246
+ /**
247
+ * Users may not always set the hour/minute for
248
+ * max value (i.e. 2021-06-02) so we should allow
249
+ * all hours/minutes in that case.
250
+ */
251
+ if (maxParts.hour !== undefined) {
252
+ processedHours = processedHours.filter((hour) => {
253
+ const convertedHour = refParts.ampm === 'pm' ? (hour + 12) % 24 : hour;
254
+ return (use24Hour ? hour : convertedHour) <= maxParts.hour;
255
+ });
256
+ isPMAllowed = maxParts.hour >= 12;
257
+ }
258
+ if (maxParts.minute !== undefined && refParts.hour === maxParts.hour) {
259
+ // The available minutes should only be filtered when the hour is the same as the max hour.
260
+ // For example if the max hour is 10:30 and the current hour is 10:00,
261
+ // users should be able to select 00-30 minutes.
262
+ // If the current hour is 09:00, users should be able to select 00-60 minutes.
263
+ processedMinutes = processedMinutes.filter((minute) => minute <= maxParts.minute);
264
+ }
265
+ /**
266
+ * If ref day is after minimum
267
+ * day do not render any hours/minute values
268
+ */
269
+ }
270
+ else if (isAfter(refParts, maxParts)) {
271
+ processedHours = [];
272
+ processedMinutes = [];
273
+ isAMAllowed = isPMAllowed = false;
274
+ }
275
+ }
276
+ return {
277
+ hours: processedHours,
278
+ minutes: processedMinutes,
279
+ am: isAMAllowed,
280
+ pm: isPMAllowed,
281
+ };
282
+ };
283
+ /**
284
+ * Given DatetimeParts, generate the previous,
285
+ * current, and and next months.
286
+ */
287
+ const generateMonths = (refParts, forcedDate) => {
288
+ const current = { month: refParts.month, year: refParts.year, day: refParts.day };
289
+ /**
290
+ * If we're forcing a month to appear, and it's different from the current month,
291
+ * ensure it appears by replacing the next or previous month as appropriate.
292
+ */
293
+ if (forcedDate !== undefined && (refParts.month !== forcedDate.month || refParts.year !== forcedDate.year)) {
294
+ const forced = { month: forcedDate.month, year: forcedDate.year, day: forcedDate.day };
295
+ const forcedMonthIsBefore = isBefore(forced, current);
296
+ return forcedMonthIsBefore
297
+ ? [forced, current, getNextMonth(refParts)]
298
+ : [getPreviousMonth(refParts), current, forced];
299
+ }
300
+ return [getPreviousMonth(refParts), current, getNextMonth(refParts)];
301
+ };
302
+ const getMonthColumnData = (locale, refParts, minParts, maxParts, monthValues, formatOptions = {
303
+ month: 'long',
304
+ }) => {
305
+ const { year } = refParts;
306
+ const months = [];
307
+ if (monthValues !== undefined) {
308
+ let processedMonths = monthValues;
309
+ if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.month) !== undefined) {
310
+ processedMonths = processedMonths.filter((month) => month <= maxParts.month);
311
+ }
312
+ if ((minParts === null || minParts === void 0 ? void 0 : minParts.month) !== undefined) {
313
+ processedMonths = processedMonths.filter((month) => month >= minParts.month);
314
+ }
315
+ processedMonths.forEach((processedMonth) => {
316
+ const date = new Date(`${processedMonth}/1/${year} GMT+0000`);
317
+ const monthString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
318
+ months.push({ text: monthString, value: processedMonth });
319
+ });
320
+ }
321
+ else {
322
+ const maxMonth = maxParts && maxParts.year === year ? maxParts.month : 12;
323
+ const minMonth = minParts && minParts.year === year ? minParts.month : 1;
324
+ for (let i = minMonth; i <= maxMonth; i++) {
325
+ /**
326
+ *
327
+ * There is a bug on iOS 14 where
328
+ * Intl.DateTimeFormat takes into account
329
+ * the local timezone offset when formatting dates.
330
+ *
331
+ * Forcing the timezone to 'UTC' fixes the issue. However,
332
+ * we should keep this workaround as it is safer. In the event
333
+ * this breaks in another browser, we will not be impacted
334
+ * because all dates will be interpreted in UTC.
335
+ *
336
+ * Example:
337
+ * new Intl.DateTimeFormat('en-US', { month: 'long' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "March"
338
+ * new Intl.DateTimeFormat('en-US', { month: 'long', timeZone: 'UTC' }).format(new Date('Sat Apr 01 2006 00:00:00 GMT-0400 (EDT)')) // "April"
339
+ *
340
+ * In certain timezones, iOS 14 shows the wrong
341
+ * date for .toUTCString(). To combat this, we
342
+ * force all of the timezones to GMT+0000 (UTC).
343
+ *
344
+ * Example:
345
+ * Time Zone: Central European Standard Time
346
+ * new Date('1/1/1992').toUTCString() // "Tue, 31 Dec 1991 23:00:00 GMT"
347
+ * new Date('1/1/1992 GMT+0000').toUTCString() // "Wed, 01 Jan 1992 00:00:00 GMT"
348
+ */
349
+ const date = new Date(`${i}/1/${year} GMT+0000`);
350
+ const monthString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
351
+ months.push({ text: monthString, value: i });
352
+ }
353
+ }
354
+ return months;
355
+ };
356
+ /**
357
+ * Returns information regarding
358
+ * selectable dates (i.e 1st, 2nd, 3rd, etc)
359
+ * within a reference month.
360
+ * @param locale The locale to format the date with
361
+ * @param refParts The reference month/year to generate dates for
362
+ * @param minParts The minimum bound on the date that can be returned
363
+ * @param maxParts The maximum bound on the date that can be returned
364
+ * @param dayValues The allowed date values
365
+ * @returns Date data to be used in ion-picker-column
366
+ */
367
+ const getDayColumnData = (locale, refParts, minParts, maxParts, dayValues, formatOptions = {
368
+ day: 'numeric',
369
+ }) => {
370
+ const { month, year } = refParts;
371
+ const days = [];
372
+ /**
373
+ * If we have max/min bounds that in the same
374
+ * month/year as the refParts, we should
375
+ * use the define day as the max/min day.
376
+ * Otherwise, fallback to the max/min days in a month.
377
+ */
378
+ const numDaysInMonth = getNumDaysInMonth(month, year);
379
+ const maxDay = (maxParts === null || maxParts === void 0 ? void 0 : maxParts.day) !== null && (maxParts === null || maxParts === void 0 ? void 0 : maxParts.day) !== undefined && maxParts.year === year && maxParts.month === month
380
+ ? maxParts.day
381
+ : numDaysInMonth;
382
+ const minDay = (minParts === null || minParts === void 0 ? void 0 : minParts.day) !== null && (minParts === null || minParts === void 0 ? void 0 : minParts.day) !== undefined && minParts.year === year && minParts.month === month
383
+ ? minParts.day
384
+ : 1;
385
+ if (dayValues !== undefined) {
386
+ let processedDays = dayValues;
387
+ processedDays = processedDays.filter((day) => day >= minDay && day <= maxDay);
388
+ processedDays.forEach((processedDay) => {
389
+ const date = new Date(`${month}/${processedDay}/${year} GMT+0000`);
390
+ const dayString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
391
+ days.push({ text: dayString, value: processedDay });
392
+ });
393
+ }
394
+ else {
395
+ for (let i = minDay; i <= maxDay; i++) {
396
+ const date = new Date(`${month}/${i}/${year} GMT+0000`);
397
+ const dayString = new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, formatOptions), { timeZone: 'UTC' })).format(date);
398
+ days.push({ text: dayString, value: i });
399
+ }
400
+ }
401
+ return days;
402
+ };
403
+ const getYearColumnData = (locale, refParts, minParts, maxParts, yearValues) => {
404
+ var _a, _b;
405
+ let processedYears = [];
406
+ if (yearValues !== undefined) {
407
+ processedYears = yearValues;
408
+ if ((maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== undefined) {
409
+ processedYears = processedYears.filter((year) => year <= maxParts.year);
410
+ }
411
+ if ((minParts === null || minParts === void 0 ? void 0 : minParts.year) !== undefined) {
412
+ processedYears = processedYears.filter((year) => year >= minParts.year);
413
+ }
414
+ }
415
+ else {
416
+ const { year } = refParts;
417
+ const maxYear = (_a = maxParts === null || maxParts === void 0 ? void 0 : maxParts.year) !== null && _a !== void 0 ? _a : year;
418
+ const minYear = (_b = minParts === null || minParts === void 0 ? void 0 : minParts.year) !== null && _b !== void 0 ? _b : year - 100;
419
+ for (let i = minYear; i <= maxYear; i++) {
420
+ processedYears.push(i);
421
+ }
422
+ }
423
+ return processedYears.map((year) => ({
424
+ text: getYear(locale, { year, month: refParts.month, day: refParts.day }),
425
+ value: year,
426
+ }));
427
+ };
428
+ /**
429
+ * Given a starting date and an upper bound,
430
+ * this functions returns an array of all
431
+ * month objects in that range.
432
+ */
433
+ const getAllMonthsInRange = (currentParts, maxParts) => {
434
+ if (currentParts.month === maxParts.month && currentParts.year === maxParts.year) {
435
+ return [currentParts];
436
+ }
437
+ return [currentParts, ...getAllMonthsInRange(getNextMonth(currentParts), maxParts)];
438
+ };
439
+ /**
440
+ * Creates and returns picker items
441
+ * that represent the days in a month.
442
+ * Example: "Thu, Jun 2"
443
+ */
444
+ const getCombinedDateColumnData = (locale, todayParts, minParts, maxParts, dayValues, monthValues) => {
445
+ let items = [];
446
+ let parts = [];
447
+ /**
448
+ * Get all month objects from the min date
449
+ * to the max date. Note: Do not use getMonthColumnData
450
+ * as that function only generates dates within a
451
+ * single year.
452
+ */
453
+ let months = getAllMonthsInRange(minParts, maxParts);
454
+ /**
455
+ * Filter out any disallowed month values.
456
+ */
457
+ if (monthValues) {
458
+ months = months.filter(({ month }) => monthValues.includes(month));
459
+ }
460
+ /**
461
+ * Get all of the days in the month.
462
+ * From there, generate an array where
463
+ * each item has the month, date, and day
464
+ * of work as the text.
465
+ */
466
+ months.forEach((monthObject) => {
467
+ const referenceMonth = { month: monthObject.month, day: null, year: monthObject.year };
468
+ const monthDays = getDayColumnData(locale, referenceMonth, minParts, maxParts, dayValues, {
469
+ month: 'short',
470
+ day: 'numeric',
471
+ weekday: 'short',
472
+ });
473
+ const dateParts = [];
474
+ const dateColumnItems = [];
475
+ monthDays.forEach((dayObject) => {
476
+ const isToday = isSameDay(Object.assign(Object.assign({}, referenceMonth), { day: dayObject.value }), todayParts);
477
+ /**
478
+ * Today's date should read as "Today" (localized)
479
+ * not the actual date string
480
+ */
481
+ dateColumnItems.push({
482
+ text: isToday ? getTodayLabel(locale) : dayObject.text,
483
+ value: `${referenceMonth.year}-${referenceMonth.month}-${dayObject.value}`,
484
+ });
485
+ /**
486
+ * When selecting a date in the wheel picker
487
+ * we need access to the raw datetime parts data.
488
+ * The picker column only accepts values of
489
+ * type string or number, so we need to return
490
+ * two sets of data: A data set to be passed
491
+ * to the picker column, and a data set to
492
+ * be used to reference the raw data when
493
+ * updating the picker column value.
494
+ */
495
+ dateParts.push({
496
+ month: referenceMonth.month,
497
+ year: referenceMonth.year,
498
+ day: dayObject.value,
499
+ });
500
+ });
501
+ parts = [...parts, ...dateParts];
502
+ items = [...items, ...dateColumnItems];
503
+ });
504
+ return {
505
+ parts,
506
+ items,
507
+ };
508
+ };
509
+ const getTimeColumnsData = (locale, refParts, hourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues) => {
510
+ const computedHourCycle = getHourCycle(locale, hourCycle);
511
+ const use24Hour = is24Hour(computedHourCycle);
512
+ const { hours, minutes, am, pm } = generateTime(locale, refParts, computedHourCycle, minParts, maxParts, allowedHourValues, allowedMinuteValues);
513
+ const hoursItems = hours.map((hour) => {
514
+ return {
515
+ text: getFormattedHour(hour, computedHourCycle),
516
+ value: getInternalHourValue(hour, use24Hour, refParts.ampm),
517
+ };
518
+ });
519
+ const minutesItems = minutes.map((minute) => {
520
+ return {
521
+ text: addTimePadding(minute),
522
+ value: minute,
523
+ };
524
+ });
525
+ const dayPeriodItems = [];
526
+ if (am && !use24Hour) {
527
+ dayPeriodItems.push({
528
+ text: getLocalizedDayPeriod(locale, 'am'),
529
+ value: 'am',
530
+ });
531
+ }
532
+ if (pm && !use24Hour) {
533
+ dayPeriodItems.push({
534
+ text: getLocalizedDayPeriod(locale, 'pm'),
535
+ value: 'pm',
536
+ });
537
+ }
538
+ return {
539
+ minutesData: minutesItems,
540
+ hoursData: hoursItems,
541
+ dayPeriodData: dayPeriodItems,
542
+ };
543
+ };
544
+
22
545
  const isYearDisabled = (refYear, minParts, maxParts) => {
23
546
  if (minParts && minParts.year > refYear) {
24
547
  return true;
@@ -1103,6 +1626,16 @@ const Datetime = class {
1103
1626
  this.closeParentOverlay(CANCEL_ROLE);
1104
1627
  }
1105
1628
  }
1629
+ /**
1630
+ * Returns the default parts the datetime falls back to when no value is set:
1631
+ * today's date and time snapped to the closest value allowed by the
1632
+ * component's constraints (`min`, `max`, and the `*Values` props).
1633
+ *
1634
+ * @internal
1635
+ */
1636
+ async getDefaultPart() {
1637
+ return this.defaultParts;
1638
+ }
1106
1639
  get isCalendarPicker() {
1107
1640
  const { presentation } = this;
1108
1641
  return presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
@@ -1924,7 +2457,7 @@ const Datetime = class {
1924
2457
  const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1925
2458
  const hasWheelVariant = hasDatePresentation && preferWheel;
1926
2459
  renderHiddenInput(true, el, name, formatValue(value), disabled);
1927
- return (h(Host, { key: '323c8c2327088f00934b8c93c3306538cb9b5677', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
2460
+ return (h(Host, { key: '0a7b458dac2de870a81d2495b5fc7ac86989f2b8', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1928
2461
  [mode]: true,
1929
2462
  ['datetime-readonly']: readonly,
1930
2463
  ['datetime-disabled']: disabled,
@@ -1934,7 +2467,7 @@ const Datetime = class {
1934
2467
  [`datetime-size-${size}`]: true,
1935
2468
  [`datetime-prefer-wheel`]: hasWheelVariant,
1936
2469
  [`datetime-grid`]: isGridStyle,
1937
- })) }, h("div", { key: '1e0855c8909bc3f1e48a21ad68159fa782060691', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
2470
+ })) }, h("div", { key: '47e77df9dd5846d46addc210d29287f34bf3cd56', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
1938
2471
  }
1939
2472
  get el() { return getElement(this); }
1940
2473
  static get watchers() { return {