@ionic/core 7.7.2-dev.11707926434.1affaed4 → 7.7.2-dev.11707941206.120570b8

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.
Files changed (35) hide show
  1. package/components/data.js +2 -7
  2. package/components/ion-datetime.js +50 -49
  3. package/dist/cjs/{data-6246812e.js → data-6df19461.js} +2 -7
  4. package/dist/cjs/ion-datetime-button.cjs.entry.js +1 -1
  5. package/dist/cjs/ion-datetime_3.cjs.entry.js +51 -50
  6. package/dist/collection/components/datetime/datetime.js +9 -49
  7. package/dist/collection/components/datetime/test/basic/datetime.e2e.js +2 -4
  8. package/dist/collection/components/datetime/test/format.spec.js +1 -15
  9. package/dist/collection/components/datetime/utils/format.js +2 -24
  10. package/dist/collection/components/datetime/utils/warn.js +45 -0
  11. package/dist/docs.json +1 -1
  12. package/dist/esm/{data-25d50209.js → data-7f65d952.js} +2 -7
  13. package/dist/esm/ion-datetime-button.entry.js +1 -1
  14. package/dist/esm/ion-datetime_3.entry.js +51 -50
  15. package/dist/esm-es5/data-7f65d952.js +4 -0
  16. package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
  17. package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
  18. package/dist/ionic/ionic.esm.js +1 -1
  19. package/dist/ionic/p-0b955124.system.js +1 -1
  20. package/dist/ionic/{p-87ae4f6c.system.entry.js → p-28a92c20.system.entry.js} +1 -1
  21. package/dist/ionic/p-56da74d7.system.entry.js +4 -0
  22. package/dist/ionic/{p-7c5e8706.entry.js → p-e1cc4ad7.entry.js} +1 -1
  23. package/dist/ionic/p-e81d133a.js +4 -0
  24. package/dist/ionic/p-ed582803.entry.js +4 -0
  25. package/dist/ionic/p-f20d9ef9.system.js +4 -0
  26. package/dist/types/components/datetime/datetime.d.ts +0 -7
  27. package/dist/types/components/datetime/utils/format.d.ts +0 -12
  28. package/dist/types/components/datetime/utils/warn.d.ts +8 -0
  29. package/hydrate/index.js +52 -56
  30. package/package.json +1 -1
  31. package/dist/esm-es5/data-25d50209.js +0 -4
  32. package/dist/ionic/p-26138fed.js +0 -4
  33. package/dist/ionic/p-68ae6719.system.entry.js +0 -4
  34. package/dist/ionic/p-8e16390d.system.js +0 -4
  35. package/dist/ionic/p-f74afe3b.entry.js +0 -4
@@ -850,7 +850,7 @@ const stripTimeZone = (formatOptions) => {
850
850
  formatOptions.timeZone = 'UTC';
851
851
  return formatOptions;
852
852
  };
853
- const getLocalizedTime = (locale, refParts, hourCycle, formatOptions) => {
853
+ const getLocalizedTime = (locale, refParts, hourCycle, formatOptions = { hour: 'numeric', minute: 'numeric' }) => {
854
854
  const timeParts = {
855
855
  hour: refParts.hour,
856
856
  minute: refParts.minute,
@@ -858,12 +858,7 @@ const getLocalizedTime = (locale, refParts, hourCycle, formatOptions) => {
858
858
  if (timeParts.hour === undefined || timeParts.minute === undefined) {
859
859
  return 'Invalid Time';
860
860
  }
861
- const defaultFormatOptions = { hour: 'numeric', minute: 'numeric' };
862
- /**
863
- * If any options are provided, don't use any of the defaults.
864
- */
865
- const options = stripTimeZone(formatOptions !== null && formatOptions !== void 0 ? formatOptions : defaultFormatOptions);
866
- return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, options), {
861
+ return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, stripTimeZone(formatOptions)), {
867
862
  /**
868
863
  * We use hourCycle here instead of hour12 due to:
869
864
  * https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
@@ -189,6 +189,48 @@ const getHighlightStyles = (highlightedDates, dateIsoString, el) => {
189
189
  return undefined;
190
190
  };
191
191
 
192
+ /**
193
+ * If a time zone is provided in the format options, the rendered text could
194
+ * differ from what was selected in the Datetime, which could cause
195
+ * confusion.
196
+ */
197
+ const warnIfTimeZoneProvided = (formatOptions) => {
198
+ var _a, _b, _c, _d;
199
+ if (((_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _a === void 0 ? void 0 : _a.timeZone) ||
200
+ ((_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _b === void 0 ? void 0 : _b.timeZoneName) ||
201
+ ((_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _c === void 0 ? void 0 : _c.timeZone) ||
202
+ ((_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _d === void 0 ? void 0 : _d.timeZoneName)) {
203
+ printIonWarning('Datetime: "timeZone" and "timeZoneName" are not supported in "formatOptions".');
204
+ }
205
+ };
206
+ const checkForPresentationFormatMismatch = (presentation, formatOptions) => {
207
+ // formatOptions is not required
208
+ if (!formatOptions)
209
+ return;
210
+ // If formatOptions is provided, the date and/or time objects are required, depending on the presentation
211
+ switch (presentation) {
212
+ case 'date':
213
+ case 'month-year':
214
+ case 'month':
215
+ case 'year':
216
+ if (formatOptions.date === undefined) {
217
+ printIonWarning(`Datetime: The '${presentation}' presentation requires a date object in formatOptions.`);
218
+ }
219
+ break;
220
+ case 'time':
221
+ if (formatOptions.time === undefined) {
222
+ printIonWarning(`Datetime: The 'time' presentation requires a time object in formatOptions.`);
223
+ }
224
+ break;
225
+ case 'date-time':
226
+ case 'time-date':
227
+ if (formatOptions.date === undefined && formatOptions.time === undefined) {
228
+ printIonWarning(`Datetime: The '${presentation}' presentation requires either a date or time object (or both) in formatOptions.`);
229
+ }
230
+ break;
231
+ }
232
+ };
233
+
192
234
  const datetimeIosCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;background:var(--background);overflow:hidden}ion-picker-column-internal{min-width:26px}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{-ms-flex-order:3;order:3;text-align:end}:host .wheel-order-year-first .month-column{-ms-flex-order:2;order:2;text-align:end}:host .wheel-order-year-first .year-column{-ms-flex-order:1;order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-flow:column;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:-ms-flexbox;display:flex}@supports (background: -webkit-named-image(apple-pay-logo-black)) and (not (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{position:absolute;visibility:hidden;pointer-events:none}@supports (inset-inline-start: 0){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{inset-inline-start:-99999px}}@supports not (inset-inline-start: 0){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{left:-99999px}:host-context([dir=rtl]):host(.show-month-and-year) .calendar-next-prev,:host-context([dir=rtl]).show-month-and-year .calendar-next-prev,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-days-of-week,:host-context([dir=rtl]).show-month-and-year .calendar-days-of-week,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-body,:host-context([dir=rtl]).show-month-and-year .calendar-body,:host-context([dir=rtl]):host(.show-month-and-year) .datetime-time,:host-context([dir=rtl]).show-month-and-year .datetime-time{left:unset;right:unset;right:-99999px}@supports selector(:dir(rtl)){:host(.show-month-and-year:dir(rtl)) .calendar-next-prev,:host(.show-month-and-year:dir(rtl)) .calendar-days-of-week,:host(.show-month-and-year:dir(rtl)) .calendar-body,:host(.show-month-and-year:dir(rtl)) .datetime-time{left:unset;right:unset;right:-99999px}}}}@supports (not (background: -webkit-named-image(apple-pay-logo-black))) or ((background: -webkit-named-image(apple-pay-logo-black)) and (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}.datetime-action-buttons .datetime-action-buttons-container{display:-ms-flexbox;display:flex}:host .calendar-action-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{--background:translucent}:host .calendar-action-buttons ion-item ion-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:auto}:host .calendar-action-buttons ion-item ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;-ms-flex-negative:0;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-flexbox;display:flex;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons ion-item{--color:var(--ion-color-base)}:host{--background:var(--ion-color-light, #ffffff);--background-rgb:var(--ion-color-light-rgb);--title-color:var(--ion-color-step-600, #666666)}:host(.datetime-presentation-date-time:not(.datetime-prefer-wheel)),:host(.datetime-presentation-time-date:not(.datetime-prefer-wheel)),:host(.datetime-presentation-date:not(.datetime-prefer-wheel)){min-height:350px}:host .datetime-header{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, #cccccc);font-size:min(0.875rem, 22.4px)}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}:host .calendar-action-buttons ion-item{--padding-start:16px;--background-hover:transparent;--background-activated:transparent;font-size:min(1rem, 25.6px);font-weight:600}:host .calendar-action-buttons ion-item ion-icon,:host .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-base)}:host .calendar-action-buttons ion-buttons{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:0}:host .calendar-action-buttons ion-buttons ion-button{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host .calendar-days-of-week{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, #b3b3b3);font-size:min(0.75rem, 19.2px);font-weight:600;line-height:24px;text-transform:uppercase}@supports (border-radius: mod(1px, 1px)){.calendar-days-of-week .day-of-week{width:clamp(20px, calc(mod(min(1rem, 24px), 24px) * 10), 100%);height:24px;overflow:hidden}.calendar-day{border-radius:max(8px, mod(min(1rem, 24px), 24px) * 10)}}@supports ((border-radius: mod(1px, 1px)) and (background: -webkit-named-image(apple-pay-logo-black)) and (not (contain-intrinsic-size: none))) or (not (border-radius: mod(1px, 1px))){.calendar-days-of-week .day-of-week{width:auto;height:auto;overflow:initial}.calendar-day{border-radius:32px}}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;-ms-flex-align:center;align-items:center;height:calc(100% - 16px)}:host .calendar-day-wrapper{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;height:0;min-height:1rem}:host .calendar-day{width:40px;min-width:40px;height:40px;font-size:min(1.25rem, 32px)}.calendar-day.calendar-day-active{background:rgba(var(--ion-color-base-rgb), 0.2)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-base);font-weight:600}:host .calendar-day.calendar-day-today.calendar-day-active{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:16px;font-size:min(1rem, 25.6px)}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, #cccccc)}:host .datetime-buttons ::slotted(ion-buttons),:host .datetime-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}:host .datetime-action-buttons{width:100%}";
193
235
  const IonDatetimeIosStyle0 = datetimeIosCss;
194
236
 
@@ -757,34 +799,6 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
757
799
  this.resolveForceDateScrolling = undefined;
758
800
  this.forceRenderDate = undefined;
759
801
  };
760
- this.checkForPresentationFormatMismatch = () => {
761
- const { formatOptions, presentation } = this;
762
- // formatOptions is not required
763
- if (!formatOptions)
764
- return;
765
- // If formatOptions is provided, the date and/or time objects are required, depending on the presentation
766
- switch (presentation) {
767
- case 'date':
768
- case 'month-year':
769
- case 'month':
770
- case 'year':
771
- if (formatOptions.date === undefined) {
772
- printIonWarning(`Datetime: The '${presentation}' presentation requires a date object in formatOptions.`, this.el);
773
- }
774
- break;
775
- case 'time':
776
- if (formatOptions.time === undefined) {
777
- printIonWarning(`Datetime: The 'time' presentation requires a time object in formatOptions.`, this.el);
778
- }
779
- break;
780
- case 'date-time':
781
- case 'time-date':
782
- if (formatOptions.date === undefined || formatOptions.time === undefined) {
783
- printIonWarning(`Datetime: The '${presentation}' presentation requires both a date and time object in formatOptions.`, this.el);
784
- }
785
- break;
786
- }
787
- };
788
802
  this.onFocus = () => {
789
803
  this.ionFocus.emit();
790
804
  };
@@ -872,8 +886,9 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
872
886
  this.preferWheel = false;
873
887
  }
874
888
  formatOptionsChanged() {
875
- this.checkForPresentationFormatMismatch();
876
- this.errorIfTimeZoneProvided();
889
+ const { formatOptions, presentation } = this;
890
+ checkForPresentationFormatMismatch(presentation, formatOptions);
891
+ warnIfTimeZoneProvided(formatOptions);
877
892
  }
878
893
  disabledChanged() {
879
894
  this.emitStyle();
@@ -885,7 +900,8 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
885
900
  this.processMaxParts();
886
901
  }
887
902
  presentationChanged() {
888
- this.checkForPresentationFormatMismatch();
903
+ const { formatOptions, presentation } = this;
904
+ checkForPresentationFormatMismatch(presentation, formatOptions);
889
905
  }
890
906
  get isGridStyle() {
891
907
  const { presentation, preferWheel } = this;
@@ -1140,8 +1156,8 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1140
1156
  }
1141
1157
  }
1142
1158
  if (formatOptions) {
1143
- this.checkForPresentationFormatMismatch();
1144
- this.errorIfTimeZoneProvided();
1159
+ checkForPresentationFormatMismatch(presentation, formatOptions);
1160
+ warnIfTimeZoneProvided(formatOptions);
1145
1161
  }
1146
1162
  const hourValues = (this.parsedHourValues = convertToArrayOfNumbers(this.hourValues));
1147
1163
  const minuteValues = (this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues));
@@ -1164,21 +1180,6 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1164
1180
  this.processValue(this.value);
1165
1181
  this.emitStyle();
1166
1182
  }
1167
- /**
1168
- * If a time zone is provided in the format options, the rendered text could
1169
- * differ from what was selected in the Datetime, which could cause
1170
- * confusion.
1171
- */
1172
- errorIfTimeZoneProvided() {
1173
- var _a, _b, _c, _d;
1174
- const { formatOptions } = this;
1175
- if (((_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _a === void 0 ? void 0 : _a.timeZone) ||
1176
- ((_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _b === void 0 ? void 0 : _b.timeZoneName) ||
1177
- ((_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _c === void 0 ? void 0 : _c.timeZone) ||
1178
- ((_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _d === void 0 ? void 0 : _d.timeZoneName)) {
1179
- printIonWarning('Datetime: "timeZone" and "timeZoneName" are not supported in "formatOptions".');
1180
- }
1181
- }
1182
1183
  emitStyle() {
1183
1184
  this.ionStyle.emit({
1184
1185
  interactive: true,
@@ -1814,7 +1815,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
1814
1815
  const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1815
1816
  const hasWheelVariant = hasDatePresentation && preferWheel;
1816
1817
  renderHiddenInput(true, el, name, formatValue(value), disabled);
1817
- return (h(Host, { key: 'ff50a7d344831b3af2e7f5cfe52b0a71c8c4b8d1', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1818
+ return (h(Host, { key: 'fc77bddc17d626819139e1c4177aa0b23d70874f', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1818
1819
  [mode]: true,
1819
1820
  ['datetime-readonly']: readonly,
1820
1821
  ['datetime-disabled']: disabled,
@@ -852,7 +852,7 @@ const stripTimeZone = (formatOptions) => {
852
852
  formatOptions.timeZone = 'UTC';
853
853
  return formatOptions;
854
854
  };
855
- const getLocalizedTime = (locale, refParts, hourCycle, formatOptions) => {
855
+ const getLocalizedTime = (locale, refParts, hourCycle, formatOptions = { hour: 'numeric', minute: 'numeric' }) => {
856
856
  const timeParts = {
857
857
  hour: refParts.hour,
858
858
  minute: refParts.minute,
@@ -860,12 +860,7 @@ const getLocalizedTime = (locale, refParts, hourCycle, formatOptions) => {
860
860
  if (timeParts.hour === undefined || timeParts.minute === undefined) {
861
861
  return 'Invalid Time';
862
862
  }
863
- const defaultFormatOptions = { hour: 'numeric', minute: 'numeric' };
864
- /**
865
- * If any options are provided, don't use any of the defaults.
866
- */
867
- const options = stripTimeZone(formatOptions !== null && formatOptions !== void 0 ? formatOptions : defaultFormatOptions);
868
- return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, options), {
863
+ return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, stripTimeZone(formatOptions)), {
869
864
  /**
870
865
  * We use hourCycle here instead of hour12 due to:
871
866
  * https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
@@ -10,7 +10,7 @@ const helpers = require('./helpers-2e1028fa.js');
10
10
  const index$1 = require('./index-5915f9b3.js');
11
11
  const theme = require('./theme-d1c573d2.js');
12
12
  const ionicGlobal = require('./ionic-global-7358c23e.js');
13
- const data = require('./data-6246812e.js');
13
+ const data = require('./data-6df19461.js');
14
14
 
15
15
  const iosDatetimeButtonCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}:host button{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px;margin-top:0px;margin-bottom:0px;position:relative;-webkit-transition:150ms color ease-in-out;transition:150ms color ease-in-out;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:1rem;cursor:pointer;overflow:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host(.time-active) #time-button,:host(.date-active) #date-button{color:var(--ion-color-base)}:host(.datetime-button-disabled){pointer-events:none}:host(.datetime-button-disabled) button{opacity:0.4}";
16
16
  const IonDatetimeButtonIosStyle0 = iosDatetimeButtonCss;
@@ -13,7 +13,7 @@ const dir = require('./dir-94c21456.js');
13
13
  const theme = require('./theme-d1c573d2.js');
14
14
  const index$2 = require('./index-f52c6d38.js');
15
15
  const ionicGlobal = require('./ionic-global-7358c23e.js');
16
- const data = require('./data-6246812e.js');
16
+ const data = require('./data-6df19461.js');
17
17
  const lockController = require('./lock-controller-6585a42a.js');
18
18
  const overlays = require('./overlays-330df245.js');
19
19
  const animation = require('./animation-fdab9de5.js');
@@ -190,6 +190,48 @@ const getHighlightStyles = (highlightedDates, dateIsoString, el) => {
190
190
  return undefined;
191
191
  };
192
192
 
193
+ /**
194
+ * If a time zone is provided in the format options, the rendered text could
195
+ * differ from what was selected in the Datetime, which could cause
196
+ * confusion.
197
+ */
198
+ const warnIfTimeZoneProvided = (formatOptions) => {
199
+ var _a, _b, _c, _d;
200
+ if (((_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _a === void 0 ? void 0 : _a.timeZone) ||
201
+ ((_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _b === void 0 ? void 0 : _b.timeZoneName) ||
202
+ ((_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _c === void 0 ? void 0 : _c.timeZone) ||
203
+ ((_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _d === void 0 ? void 0 : _d.timeZoneName)) {
204
+ index.printIonWarning('Datetime: "timeZone" and "timeZoneName" are not supported in "formatOptions".');
205
+ }
206
+ };
207
+ const checkForPresentationFormatMismatch = (presentation, formatOptions) => {
208
+ // formatOptions is not required
209
+ if (!formatOptions)
210
+ return;
211
+ // If formatOptions is provided, the date and/or time objects are required, depending on the presentation
212
+ switch (presentation) {
213
+ case 'date':
214
+ case 'month-year':
215
+ case 'month':
216
+ case 'year':
217
+ if (formatOptions.date === undefined) {
218
+ index.printIonWarning(`Datetime: The '${presentation}' presentation requires a date object in formatOptions.`);
219
+ }
220
+ break;
221
+ case 'time':
222
+ if (formatOptions.time === undefined) {
223
+ index.printIonWarning(`Datetime: The 'time' presentation requires a time object in formatOptions.`);
224
+ }
225
+ break;
226
+ case 'date-time':
227
+ case 'time-date':
228
+ if (formatOptions.date === undefined && formatOptions.time === undefined) {
229
+ index.printIonWarning(`Datetime: The '${presentation}' presentation requires either a date or time object (or both) in formatOptions.`);
230
+ }
231
+ break;
232
+ }
233
+ };
234
+
193
235
  const datetimeIosCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;background:var(--background);overflow:hidden}ion-picker-column-internal{min-width:26px}:host(.datetime-size-fixed){width:auto;height:auto}:host(.datetime-size-fixed:not(.datetime-prefer-wheel)){max-width:350px}:host(.datetime-size-fixed.datetime-prefer-wheel){min-width:350px;max-width:-webkit-max-content;max-width:-moz-max-content;max-width:max-content}:host(.datetime-size-cover){width:100%}:host .calendar-body,:host .datetime-year{opacity:0}:host(:not(.datetime-ready)) .datetime-year{position:absolute;pointer-events:none}:host(.datetime-ready) .calendar-body{opacity:1}:host(.datetime-ready) .datetime-year{display:none;opacity:1}:host .wheel-order-year-first .day-column{-ms-flex-order:3;order:3;text-align:end}:host .wheel-order-year-first .month-column{-ms-flex-order:2;order:2;text-align:end}:host .wheel-order-year-first .year-column{-ms-flex-order:1;order:1;text-align:start}:host .datetime-calendar,:host .datetime-year{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-flow:column;flex-flow:column}:host(.show-month-and-year) .datetime-year{display:-ms-flexbox;display:flex}@supports (background: -webkit-named-image(apple-pay-logo-black)) and (not (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{position:absolute;visibility:hidden;pointer-events:none}@supports (inset-inline-start: 0){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{inset-inline-start:-99999px}}@supports not (inset-inline-start: 0){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{left:-99999px}:host-context([dir=rtl]):host(.show-month-and-year) .calendar-next-prev,:host-context([dir=rtl]).show-month-and-year .calendar-next-prev,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-days-of-week,:host-context([dir=rtl]).show-month-and-year .calendar-days-of-week,:host-context([dir=rtl]):host(.show-month-and-year) .calendar-body,:host-context([dir=rtl]).show-month-and-year .calendar-body,:host-context([dir=rtl]):host(.show-month-and-year) .datetime-time,:host-context([dir=rtl]).show-month-and-year .datetime-time{left:unset;right:unset;right:-99999px}@supports selector(:dir(rtl)){:host(.show-month-and-year:dir(rtl)) .calendar-next-prev,:host(.show-month-and-year:dir(rtl)) .calendar-days-of-week,:host(.show-month-and-year:dir(rtl)) .calendar-body,:host(.show-month-and-year:dir(rtl)) .datetime-time{left:unset;right:unset;right:-99999px}}}}@supports (not (background: -webkit-named-image(apple-pay-logo-black))) or ((background: -webkit-named-image(apple-pay-logo-black)) and (aspect-ratio: 1/1)){:host(.show-month-and-year) .calendar-next-prev,:host(.show-month-and-year) .calendar-days-of-week,:host(.show-month-and-year) .calendar-body,:host(.show-month-and-year) .datetime-time{display:none}}:host(.month-year-picker-open) .datetime-footer{display:none}:host(.datetime-disabled){pointer-events:none}:host(.datetime-disabled) .calendar-days-of-week,:host(.datetime-disabled) .datetime-time{opacity:0.4}:host(.datetime-readonly){pointer-events:none;}:host(.datetime-readonly) .calendar-action-buttons,:host(.datetime-readonly) .calendar-body,:host(.datetime-readonly) .datetime-year{pointer-events:initial}:host(.datetime-readonly) .calendar-day[disabled]:not(.calendar-day-constrained),:host(.datetime-readonly) .datetime-action-buttons ion-button[disabled]{opacity:1}:host .datetime-header .datetime-title{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host .datetime-action-buttons.has-clear-button{width:100%}:host .datetime-action-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}.datetime-action-buttons .datetime-action-buttons-container{display:-ms-flexbox;display:flex}:host .calendar-action-buttons{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host .calendar-action-buttons ion-item,:host .calendar-action-buttons ion-button{--background:translucent}:host .calendar-action-buttons ion-item ion-label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;width:auto}:host .calendar-action-buttons ion-item ion-icon{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:0;padding-inline-end:0;padding-top:0;padding-bottom:0}:host .calendar-days-of-week{display:grid;grid-template-columns:repeat(7, 1fr);text-align:center}.calendar-days-of-week .day-of-week{-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto;margin-top:0;margin-bottom:0}:host .calendar-body{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-x:scroll;overflow-y:hidden;scrollbar-width:none;outline:none}:host .calendar-body .calendar-month{display:-ms-flexbox;display:flex;-ms-flex-flow:column;flex-flow:column;scroll-snap-align:start;scroll-snap-stop:always;-ms-flex-negative:0;flex-shrink:0;width:100%}:host .calendar-body .calendar-month-disabled{scroll-snap-align:none}:host .calendar-body::-webkit-scrollbar{display:none}:host .calendar-body .calendar-month-grid{display:grid;grid-template-columns:repeat(7, 1fr)}:host .calendar-day-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:0;min-height:0;overflow:visible}.calendar-day{border-radius:50%;-webkit-padding-start:0px;padding-inline-start:0px;-webkit-padding-end:0px;padding-inline-end:0px;padding-top:0px;padding-bottom:0px;-webkit-margin-start:0px;margin-inline-start:0px;-webkit-margin-end:0px;margin-inline-end:0px;margin-top:0px;margin-bottom:0px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border:none;outline:none;background:none;color:currentColor;font-family:var(--ion-font-family, inherit);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;z-index:0}:host .calendar-day[disabled]{pointer-events:none;opacity:0.4}.calendar-day:focus{background:rgba(var(--ion-color-base-rgb), 0.2);-webkit-box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2);box-shadow:0px 0px 0px 4px rgba(var(--ion-color-base-rgb), 0.2)}:host .datetime-time{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between}:host(.datetime-presentation-time) .datetime-time{padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host ion-popover{--height:200px}:host .time-header{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .time-body{border-radius:8px;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px;padding-top:6px;padding-bottom:6px;display:-ms-flexbox;display:flex;border:none;background:var(--ion-color-step-300, #edeef0);color:var(--ion-text-color, #000);font-family:inherit;font-size:inherit;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}:host .time-body-active{color:var(--ion-color-base)}:host(.in-item){position:static}:host(.show-month-and-year) .calendar-action-buttons ion-item{--color:var(--ion-color-base)}:host{--background:var(--ion-color-light, #ffffff);--background-rgb:var(--ion-color-light-rgb);--title-color:var(--ion-color-step-600, #666666)}:host(.datetime-presentation-date-time:not(.datetime-prefer-wheel)),:host(.datetime-presentation-time-date:not(.datetime-prefer-wheel)),:host(.datetime-presentation-date:not(.datetime-prefer-wheel)){min-height:350px}:host .datetime-header{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:16px;padding-bottom:16px;border-bottom:0.55px solid var(--ion-color-step-200, #cccccc);font-size:min(0.875rem, 22.4px)}:host .datetime-header .datetime-title{color:var(--title-color)}:host .datetime-header .datetime-selected-date{margin-top:10px}:host .calendar-action-buttons ion-item{--padding-start:16px;--background-hover:transparent;--background-activated:transparent;font-size:min(1rem, 25.6px);font-weight:600}:host .calendar-action-buttons ion-item ion-icon,:host .calendar-action-buttons ion-buttons ion-button{color:var(--ion-color-base)}:host .calendar-action-buttons ion-buttons{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:0}:host .calendar-action-buttons ion-buttons ion-button{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host .calendar-days-of-week{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:0;padding-bottom:0;color:var(--ion-color-step-300, #b3b3b3);font-size:min(0.75rem, 19.2px);font-weight:600;line-height:24px;text-transform:uppercase}@supports (border-radius: mod(1px, 1px)){.calendar-days-of-week .day-of-week{width:clamp(20px, calc(mod(min(1rem, 24px), 24px) * 10), 100%);height:24px;overflow:hidden}.calendar-day{border-radius:max(8px, mod(min(1rem, 24px), 24px) * 10)}}@supports ((border-radius: mod(1px, 1px)) and (background: -webkit-named-image(apple-pay-logo-black)) and (not (contain-intrinsic-size: none))) or (not (border-radius: mod(1px, 1px))){.calendar-days-of-week .day-of-week{width:auto;height:auto;overflow:initial}.calendar-day{border-radius:32px}}:host .calendar-body .calendar-month .calendar-month-grid{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;-ms-flex-align:center;align-items:center;height:calc(100% - 16px)}:host .calendar-day-wrapper{-webkit-padding-start:4px;padding-inline-start:4px;-webkit-padding-end:4px;padding-inline-end:4px;padding-top:4px;padding-bottom:4px;height:0;min-height:1rem}:host .calendar-day{width:40px;min-width:40px;height:40px;font-size:min(1.25rem, 32px)}.calendar-day.calendar-day-active{background:rgba(var(--ion-color-base-rgb), 0.2)}:host .calendar-day.calendar-day-today{color:var(--ion-color-base)}:host .calendar-day.calendar-day-active{color:var(--ion-color-base);font-weight:600}:host .calendar-day.calendar-day-today.calendar-day-active{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host .datetime-time{-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:16px;font-size:min(1rem, 25.6px)}:host .datetime-time .time-header{font-weight:600}:host .datetime-buttons{-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;border-top:0.55px solid var(--ion-color-step-200, #cccccc)}:host .datetime-buttons ::slotted(ion-buttons),:host .datetime-buttons ion-buttons{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}:host .datetime-action-buttons{width:100%}";
194
236
  const IonDatetimeIosStyle0 = datetimeIosCss;
195
237
 
@@ -756,34 +798,6 @@ const Datetime = class {
756
798
  this.resolveForceDateScrolling = undefined;
757
799
  this.forceRenderDate = undefined;
758
800
  };
759
- this.checkForPresentationFormatMismatch = () => {
760
- const { formatOptions, presentation } = this;
761
- // formatOptions is not required
762
- if (!formatOptions)
763
- return;
764
- // If formatOptions is provided, the date and/or time objects are required, depending on the presentation
765
- switch (presentation) {
766
- case 'date':
767
- case 'month-year':
768
- case 'month':
769
- case 'year':
770
- if (formatOptions.date === undefined) {
771
- index.printIonWarning(`Datetime: The '${presentation}' presentation requires a date object in formatOptions.`, this.el);
772
- }
773
- break;
774
- case 'time':
775
- if (formatOptions.time === undefined) {
776
- index.printIonWarning(`Datetime: The 'time' presentation requires a time object in formatOptions.`, this.el);
777
- }
778
- break;
779
- case 'date-time':
780
- case 'time-date':
781
- if (formatOptions.date === undefined || formatOptions.time === undefined) {
782
- index.printIonWarning(`Datetime: The '${presentation}' presentation requires both a date and time object in formatOptions.`, this.el);
783
- }
784
- break;
785
- }
786
- };
787
801
  this.onFocus = () => {
788
802
  this.ionFocus.emit();
789
803
  };
@@ -871,8 +885,9 @@ const Datetime = class {
871
885
  this.preferWheel = false;
872
886
  }
873
887
  formatOptionsChanged() {
874
- this.checkForPresentationFormatMismatch();
875
- this.errorIfTimeZoneProvided();
888
+ const { formatOptions, presentation } = this;
889
+ checkForPresentationFormatMismatch(presentation, formatOptions);
890
+ warnIfTimeZoneProvided(formatOptions);
876
891
  }
877
892
  disabledChanged() {
878
893
  this.emitStyle();
@@ -884,7 +899,8 @@ const Datetime = class {
884
899
  this.processMaxParts();
885
900
  }
886
901
  presentationChanged() {
887
- this.checkForPresentationFormatMismatch();
902
+ const { formatOptions, presentation } = this;
903
+ checkForPresentationFormatMismatch(presentation, formatOptions);
888
904
  }
889
905
  get isGridStyle() {
890
906
  const { presentation, preferWheel } = this;
@@ -1139,8 +1155,8 @@ const Datetime = class {
1139
1155
  }
1140
1156
  }
1141
1157
  if (formatOptions) {
1142
- this.checkForPresentationFormatMismatch();
1143
- this.errorIfTimeZoneProvided();
1158
+ checkForPresentationFormatMismatch(presentation, formatOptions);
1159
+ warnIfTimeZoneProvided(formatOptions);
1144
1160
  }
1145
1161
  const hourValues = (this.parsedHourValues = data.convertToArrayOfNumbers(this.hourValues));
1146
1162
  const minuteValues = (this.parsedMinuteValues = data.convertToArrayOfNumbers(this.minuteValues));
@@ -1163,21 +1179,6 @@ const Datetime = class {
1163
1179
  this.processValue(this.value);
1164
1180
  this.emitStyle();
1165
1181
  }
1166
- /**
1167
- * If a time zone is provided in the format options, the rendered text could
1168
- * differ from what was selected in the Datetime, which could cause
1169
- * confusion.
1170
- */
1171
- errorIfTimeZoneProvided() {
1172
- var _a, _b, _c, _d;
1173
- const { formatOptions } = this;
1174
- if (((_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _a === void 0 ? void 0 : _a.timeZone) ||
1175
- ((_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _b === void 0 ? void 0 : _b.timeZoneName) ||
1176
- ((_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _c === void 0 ? void 0 : _c.timeZone) ||
1177
- ((_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _d === void 0 ? void 0 : _d.timeZoneName)) {
1178
- index.printIonWarning('Datetime: "timeZone" and "timeZoneName" are not supported in "formatOptions".');
1179
- }
1180
- }
1181
1182
  emitStyle() {
1182
1183
  this.ionStyle.emit({
1183
1184
  interactive: true,
@@ -1813,7 +1814,7 @@ const Datetime = class {
1813
1814
  const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1814
1815
  const hasWheelVariant = hasDatePresentation && preferWheel;
1815
1816
  helpers.renderHiddenInput(true, el, name, data.formatValue(value), disabled);
1816
- return (index$1.h(index$1.Host, { key: 'ff50a7d344831b3af2e7f5cfe52b0a71c8c4b8d1', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, theme.createColorClasses(color, {
1817
+ return (index$1.h(index$1.Host, { key: 'fc77bddc17d626819139e1c4177aa0b23d70874f', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, theme.createColorClasses(color, {
1817
1818
  [mode]: true,
1818
1819
  ['datetime-readonly']: readonly,
1819
1820
  ['datetime-disabled']: disabled,
@@ -16,6 +16,7 @@ import { isLocaleDayPeriodRTL, isMonthFirstLocale, getNumDaysInMonth, getHourCyc
16
16
  import { calculateHourFromAMPM, convertDataToISO, getClosestValidDate, getEndOfWeek, getNextDay, getNextMonth, getNextWeek, getNextYear, getPreviousDay, getPreviousMonth, getPreviousWeek, getPreviousYear, getStartOfWeek, validateParts, } from "./utils/manipulation";
17
17
  import { clampDate, convertToArrayOfNumbers, getPartsFromCalendarDay, parseAmPm, parseDate, parseMaxParts, parseMinParts, } from "./utils/parse";
18
18
  import { getCalendarDayState, getHighlightStyles, isDayDisabled, isMonthDisabled, isNextMonthDisabled, isPrevMonthDisabled, } from "./utils/state";
19
+ import { checkForPresentationFormatMismatch, warnIfTimeZoneProvided } from "./utils/warn";
19
20
  /**
20
21
  * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
21
22
  *
@@ -592,34 +593,6 @@ export class Datetime {
592
593
  this.resolveForceDateScrolling = undefined;
593
594
  this.forceRenderDate = undefined;
594
595
  };
595
- this.checkForPresentationFormatMismatch = () => {
596
- const { formatOptions, presentation } = this;
597
- // formatOptions is not required
598
- if (!formatOptions)
599
- return;
600
- // If formatOptions is provided, the date and/or time objects are required, depending on the presentation
601
- switch (presentation) {
602
- case 'date':
603
- case 'month-year':
604
- case 'month':
605
- case 'year':
606
- if (formatOptions.date === undefined) {
607
- printIonWarning(`Datetime: The '${presentation}' presentation requires a date object in formatOptions.`, this.el);
608
- }
609
- break;
610
- case 'time':
611
- if (formatOptions.time === undefined) {
612
- printIonWarning(`Datetime: The 'time' presentation requires a time object in formatOptions.`, this.el);
613
- }
614
- break;
615
- case 'date-time':
616
- case 'time-date':
617
- if (formatOptions.date === undefined || formatOptions.time === undefined) {
618
- printIonWarning(`Datetime: The '${presentation}' presentation requires both a date and time object in formatOptions.`, this.el);
619
- }
620
- break;
621
- }
622
- };
623
596
  this.onFocus = () => {
624
597
  this.ionFocus.emit();
625
598
  };
@@ -707,8 +680,9 @@ export class Datetime {
707
680
  this.preferWheel = false;
708
681
  }
709
682
  formatOptionsChanged() {
710
- this.checkForPresentationFormatMismatch();
711
- this.errorIfTimeZoneProvided();
683
+ const { formatOptions, presentation } = this;
684
+ checkForPresentationFormatMismatch(presentation, formatOptions);
685
+ warnIfTimeZoneProvided(formatOptions);
712
686
  }
713
687
  disabledChanged() {
714
688
  this.emitStyle();
@@ -720,7 +694,8 @@ export class Datetime {
720
694
  this.processMaxParts();
721
695
  }
722
696
  presentationChanged() {
723
- this.checkForPresentationFormatMismatch();
697
+ const { formatOptions, presentation } = this;
698
+ checkForPresentationFormatMismatch(presentation, formatOptions);
724
699
  }
725
700
  get isGridStyle() {
726
701
  const { presentation, preferWheel } = this;
@@ -975,8 +950,8 @@ export class Datetime {
975
950
  }
976
951
  }
977
952
  if (formatOptions) {
978
- this.checkForPresentationFormatMismatch();
979
- this.errorIfTimeZoneProvided();
953
+ checkForPresentationFormatMismatch(presentation, formatOptions);
954
+ warnIfTimeZoneProvided(formatOptions);
980
955
  }
981
956
  const hourValues = (this.parsedHourValues = convertToArrayOfNumbers(this.hourValues));
982
957
  const minuteValues = (this.parsedMinuteValues = convertToArrayOfNumbers(this.minuteValues));
@@ -999,21 +974,6 @@ export class Datetime {
999
974
  this.processValue(this.value);
1000
975
  this.emitStyle();
1001
976
  }
1002
- /**
1003
- * If a time zone is provided in the format options, the rendered text could
1004
- * differ from what was selected in the Datetime, which could cause
1005
- * confusion.
1006
- */
1007
- errorIfTimeZoneProvided() {
1008
- var _a, _b, _c, _d;
1009
- const { formatOptions } = this;
1010
- if (((_a = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _a === void 0 ? void 0 : _a.timeZone) ||
1011
- ((_b = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.date) === null || _b === void 0 ? void 0 : _b.timeZoneName) ||
1012
- ((_c = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _c === void 0 ? void 0 : _c.timeZone) ||
1013
- ((_d = formatOptions === null || formatOptions === void 0 ? void 0 : formatOptions.time) === null || _d === void 0 ? void 0 : _d.timeZoneName)) {
1014
- printIonWarning('Datetime: "timeZone" and "timeZoneName" are not supported in "formatOptions".');
1015
- }
1016
- }
1017
977
  emitStyle() {
1018
978
  this.ionStyle.emit({
1019
979
  interactive: true,
@@ -1649,7 +1609,7 @@ export class Datetime {
1649
1609
  const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
1650
1610
  const hasWheelVariant = hasDatePresentation && preferWheel;
1651
1611
  renderHiddenInput(true, el, name, formatValue(value), disabled);
1652
- return (h(Host, { key: 'ff50a7d344831b3af2e7f5cfe52b0a71c8c4b8d1', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1612
+ return (h(Host, { key: 'fc77bddc17d626819139e1c4177aa0b23d70874f', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
1653
1613
  [mode]: true,
1654
1614
  ['datetime-readonly']: readonly,
1655
1615
  ['datetime-disabled']: disabled,
@@ -470,14 +470,12 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
470
470
  </ion-datetime>
471
471
  <script>
472
472
  const datetime = document.querySelector('ion-datetime');
473
- datetime.formatOptions = {
474
- time: { hour: '2-digit', minute: '2-digit' },
475
- }
473
+ datetime.formatOptions = {}
476
474
  </script>
477
475
  `, config);
478
476
  await page.locator('.datetime-ready').waitFor();
479
477
  expect(logs.length).toBe(1);
480
- expect(logs[0]).toContain("[Ionic Warning]: Datetime: The 'date-time' presentation requires both a date and time object in formatOptions.");
478
+ expect(logs[0]).toContain("[Ionic Warning]: Datetime: The 'date-time' presentation requires either a date or time object (or both) in formatOptions.");
481
479
  });
482
480
  });
483
481
  });
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
- import { generateDayAriaLabel, getMonthAndDay, getFormattedHour, addTimePadding, getMonthAndYear, getLocalizedDayPeriod, getLocalizedTime, stripTimeZone, } from "../utils/format";
4
+ import { generateDayAriaLabel, getFormattedHour, addTimePadding, getMonthAndYear, getLocalizedDayPeriod, getLocalizedTime, stripTimeZone, } from "../utils/format";
5
5
  describe('generateDayAriaLabel()', () => {
6
6
  it('should return Wednesday, May 12', () => {
7
7
  const reference = { month: 5, day: 12, year: 2021 };
@@ -24,20 +24,6 @@ describe('generateDayAriaLabel()', () => {
24
24
  expect(generateDayAriaLabel('en-US', false, reference)).toEqual('Saturday, April 1');
25
25
  });
26
26
  });
27
- describe('getMonthAndDay()', () => {
28
- it('should return Tue, May 11', () => {
29
- expect(getMonthAndDay('en-US', { month: 5, day: 11, year: 2021 })).toEqual('Tue, May 11');
30
- });
31
- it('should return mar, 11 may', () => {
32
- expect(getMonthAndDay('es-ES', { month: 5, day: 11, year: 2021 })).toEqual('mar, 11 may');
33
- });
34
- it('should return Sat, Apr 1', () => {
35
- expect(getMonthAndDay('en-US', { month: 4, day: 1, year: 2006 })).toEqual('Sat, Apr 1');
36
- });
37
- it('should return sáb, 1 abr', () => {
38
- expect(getMonthAndDay('es-ES', { month: 4, day: 1, year: 2006 })).toEqual('sáb, 1 abr');
39
- });
40
- });
41
27
  describe('getFormattedHour()', () => {
42
28
  it('should only add padding if using 24 hour time', () => {
43
29
  expect(getFormattedHour(1, 'h11')).toEqual('1');
@@ -27,7 +27,7 @@ export const stripTimeZone = (formatOptions) => {
27
27
  formatOptions.timeZone = 'UTC';
28
28
  return formatOptions;
29
29
  };
30
- export const getLocalizedTime = (locale, refParts, hourCycle, formatOptions) => {
30
+ export const getLocalizedTime = (locale, refParts, hourCycle, formatOptions = { hour: 'numeric', minute: 'numeric' }) => {
31
31
  const timeParts = {
32
32
  hour: refParts.hour,
33
33
  minute: refParts.minute,
@@ -35,12 +35,7 @@ export const getLocalizedTime = (locale, refParts, hourCycle, formatOptions) =>
35
35
  if (timeParts.hour === undefined || timeParts.minute === undefined) {
36
36
  return 'Invalid Time';
37
37
  }
38
- const defaultFormatOptions = { hour: 'numeric', minute: 'numeric' };
39
- /**
40
- * If any options are provided, don't use any of the defaults.
41
- */
42
- const options = stripTimeZone(formatOptions !== null && formatOptions !== void 0 ? formatOptions : defaultFormatOptions);
43
- return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, options), {
38
+ return new Intl.DateTimeFormat(locale, Object.assign(Object.assign({}, stripTimeZone(formatOptions)), {
44
39
  /**
45
40
  * We use hourCycle here instead of hour12 due to:
46
41
  * https://bugs.chromium.org/p/chromium/issues/detail?id=1347316&q=hour12&can=2
@@ -133,14 +128,6 @@ export const generateDayAriaLabel = (locale, today, refParts) => {
133
128
  */
134
129
  return today ? `Today, ${labelString}` : labelString;
135
130
  };
136
- /**
137
- * Gets the day of the week, month, and day
138
- * Used for the header in MD mode.
139
- */
140
- export const getMonthAndDay = (locale, refParts) => {
141
- const date = getNormalizedDate(refParts);
142
- return new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric', timeZone: 'UTC' }).format(date);
143
- };
144
131
  /**
145
132
  * Given a locale and a date object,
146
133
  * return a formatted string that includes
@@ -151,15 +138,6 @@ export const getMonthAndYear = (locale, refParts) => {
151
138
  const date = getNormalizedDate(refParts);
152
139
  return new Intl.DateTimeFormat(locale, { month: 'long', year: 'numeric', timeZone: 'UTC' }).format(date);
153
140
  };
154
- /**
155
- * Given a locale and a date object,
156
- * return a formatted string that includes
157
- * the short month, numeric day, and full year.
158
- * Example: Apr 22, 2021
159
- */
160
- export const getMonthDayAndYear = (locale, refParts) => {
161
- return getLocalizedDateTime(locale, refParts, { month: 'short', day: 'numeric', year: 'numeric' });
162
- };
163
141
  /**
164
142
  * Given a locale and a date object,
165
143
  * return a formatted string that includes