@sme.up/ketchup 9.0.0 → 9.2.0

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 (219) hide show
  1. package/dist/cjs/{f-button-b2cfce1c.js → f-button-9ccadd52.js} +2 -2
  2. package/dist/cjs/{f-cell-75fca92b.js → f-cell-3130506f.js} +183 -11
  3. package/dist/cjs/{f-checkbox-48d7af02.js → f-checkbox-9d2635d9.js} +1 -1
  4. package/dist/cjs/{f-chip-3e504f3e.js → f-chip-beb7af58.js} +3 -3
  5. package/dist/cjs/{f-image-270d39ae.js → f-image-66a3c3c1.js} +2 -2
  6. package/dist/cjs/{f-paginator-utils-6d0c4678.js → f-paginator-utils-c475e07f.js} +49 -50
  7. package/dist/cjs/{f-text-field-bbcd2143.js → f-text-field-c74856ff.js} +38 -4
  8. package/dist/cjs/{index-c3d10561.js → index-d8e5eb5f.js} +156 -39
  9. package/dist/cjs/index.cjs.js +11 -0
  10. package/dist/cjs/ketchup.cjs.js +3 -3
  11. package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
  12. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +159 -197
  13. package/dist/cjs/kup-box.cjs.entry.js +23 -15
  14. package/dist/cjs/kup-calendar.cjs.entry.js +5061 -5028
  15. package/dist/cjs/kup-card-list.cjs.entry.js +34 -14
  16. package/dist/cjs/kup-cell.cjs.entry.js +9 -7
  17. package/dist/cjs/kup-dashboard.cjs.entry.js +6 -6
  18. package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
  19. package/dist/cjs/kup-echart.cjs.entry.js +2 -2
  20. package/dist/cjs/kup-family-tree.cjs.entry.js +4 -4
  21. package/dist/cjs/kup-grid.cjs.entry.js +2 -2
  22. package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
  23. package/dist/cjs/kup-image-list.cjs.entry.js +8 -8
  24. package/dist/cjs/kup-lazy.cjs.entry.js +2 -2
  25. package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
  26. package/dist/cjs/{kup-manager-130bbd9d.js → kup-manager-7334c396.js} +63 -12
  27. package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
  28. package/dist/cjs/kup-numeric-picker.cjs.entry.js +3 -3
  29. package/dist/cjs/kup-photo-frame.cjs.entry.js +2 -2
  30. package/dist/cjs/kup-planner.cjs.entry.js +895 -410
  31. package/dist/cjs/kup-probe.cjs.entry.js +2 -2
  32. package/dist/cjs/kup-qlik.cjs.entry.js +2 -2
  33. package/dist/cjs/kup-snackbar.cjs.entry.js +4 -4
  34. package/dist/cjs/loader.cjs.js +2 -2
  35. package/dist/collection/assets/card-list.js +12 -9
  36. package/dist/collection/assets/index.js +4 -0
  37. package/dist/collection/assets/progress-bar.js +0 -0
  38. package/dist/collection/assets/radio.js +30 -0
  39. package/dist/collection/collection-manifest.json +2 -2
  40. package/dist/collection/components/kup-box/kup-box.js +14 -6
  41. package/dist/collection/components/kup-card/kup-card.css +14 -0
  42. package/dist/collection/components/kup-card/standard/kup-card-standard.js +10 -5
  43. package/dist/collection/components/kup-card-list/kup-card-list-declarations.js +10 -0
  44. package/dist/collection/components/kup-card-list/kup-card-list.js +232 -12
  45. package/dist/collection/components/kup-data-table/kup-data-table-helper.js +47 -48
  46. package/dist/collection/components/kup-data-table/kup-data-table.js +36 -22
  47. package/dist/collection/components/kup-progress-bar/kup-progress-bar.css +1 -242
  48. package/dist/collection/components/kup-progress-bar/kup-progress-bar.js +37 -84
  49. package/dist/collection/components/kup-radio/kup-radio.css +0 -161
  50. package/dist/collection/components/kup-radio/kup-radio.js +31 -26
  51. package/dist/collection/components/kup-rating/kup-rating.css +0 -8
  52. package/dist/collection/components/kup-rating/kup-rating.js +27 -52
  53. package/dist/collection/f-components/f-cell/f-cell-declarations.js +1 -0
  54. package/dist/collection/f-components/f-cell/f-cell.js +19 -5
  55. package/dist/collection/f-components/f-progress-bar/f-progress-bar-declarations.js +1 -0
  56. package/dist/collection/f-components/f-progress-bar/f-progress-bar.js +88 -0
  57. package/dist/collection/f-components/f-radio/f-radio-declarations.js +1 -0
  58. package/dist/collection/f-components/f-radio/f-radio.js +28 -0
  59. package/dist/collection/f-components/f-rating/f-rating-declarations.js +1 -0
  60. package/dist/collection/f-components/f-rating/f-rating.js +26 -0
  61. package/dist/collection/f-components/f-text-field/f-text-field.js +36 -2
  62. package/dist/collection/index.js +5 -0
  63. package/dist/collection/managers/kup-data/kup-data.js +2 -0
  64. package/dist/collection/managers/kup-math/kup-math-helper.js +1 -1
  65. package/dist/collection/managers/kup-theme/kup-theme-declarations.js +33 -0
  66. package/dist/collection/managers/kup-theme/kup-theme.js +13 -1
  67. package/dist/collection/utils/cell-utils.js +6 -7
  68. package/dist/collection/utils/utils.js +0 -5
  69. package/dist/components/index.d.ts +6 -0
  70. package/dist/components/index.js +9 -1
  71. package/dist/components/kup-accordion.js +4 -1
  72. package/dist/components/kup-autocomplete.js +1 -1
  73. package/dist/components/kup-autocomplete2.js +13902 -32341
  74. package/dist/components/kup-badge.js +1 -1
  75. package/dist/components/kup-box2.js +26 -7
  76. package/dist/components/kup-button-list.js +1 -1
  77. package/dist/components/kup-button.js +1 -1
  78. package/dist/components/kup-calendar.js +5001 -4964
  79. package/dist/components/kup-card-list.js +44 -13
  80. package/dist/components/kup-card.js +1 -1
  81. package/dist/components/kup-cell.js +2 -1
  82. package/dist/components/kup-chart.js +1 -1
  83. package/dist/components/kup-checkbox.js +1 -1
  84. package/dist/components/kup-chip.js +1 -1
  85. package/dist/components/kup-color-picker.js +1 -1
  86. package/dist/components/kup-combobox.js +1 -1
  87. package/dist/components/kup-dashboard.js +4 -1
  88. package/dist/components/kup-data-table.js +1 -1
  89. package/dist/components/kup-date-picker.js +1 -1
  90. package/dist/components/kup-dialog.js +1 -1
  91. package/dist/components/kup-drawer.js +2 -1
  92. package/dist/components/kup-dropdown-button.js +1 -1
  93. package/dist/components/kup-echart2.js +2 -1
  94. package/dist/components/kup-family-tree.js +2 -1
  95. package/dist/components/kup-form.js +1 -1
  96. package/dist/components/kup-gauge.js +1 -1
  97. package/dist/components/kup-grid2.js +2 -1
  98. package/dist/components/kup-iframe.js +2 -1
  99. package/dist/components/kup-image-list.js +4 -1
  100. package/dist/components/kup-image.js +1 -1
  101. package/dist/components/kup-lazy.js +2 -1
  102. package/dist/components/kup-list.js +1 -1
  103. package/dist/components/kup-magic-box.js +2 -1
  104. package/dist/{esm/kup-manager-c8d5c94d.js → components/kup-manager.js} +63 -13
  105. package/dist/components/kup-nav-bar.js +2 -1
  106. package/dist/components/kup-numeric-picker.js +2 -1
  107. package/dist/components/kup-photo-frame.js +2 -1
  108. package/dist/components/kup-planner.js +896 -408
  109. package/dist/components/kup-probe.js +2 -1
  110. package/dist/components/kup-progress-bar.js +1 -1
  111. package/dist/components/kup-qlik.js +2 -1
  112. package/dist/components/kup-radio.js +1 -1
  113. package/dist/components/kup-rating.js +1 -1
  114. package/dist/components/kup-snackbar.js +2 -1
  115. package/dist/components/kup-spinner.js +1 -1
  116. package/dist/components/kup-switch.js +1 -1
  117. package/dist/components/kup-tab-bar.js +1 -1
  118. package/dist/components/kup-text-field.js +1 -1
  119. package/dist/components/kup-time-picker.js +1 -1
  120. package/dist/components/kup-tree.js +1 -1
  121. package/dist/esm/{f-button-baa419dc.js → f-button-0bce6587.js} +2 -2
  122. package/dist/esm/{f-cell-18ee3afa.js → f-cell-88d375e1.js} +181 -12
  123. package/dist/esm/{f-checkbox-00a1e020.js → f-checkbox-31219c42.js} +1 -1
  124. package/dist/esm/{f-chip-311500f4.js → f-chip-ef0d4130.js} +3 -3
  125. package/dist/esm/{f-image-da03494c.js → f-image-727453df.js} +2 -2
  126. package/dist/esm/{f-paginator-utils-d63a195e.js → f-paginator-utils-4524e41c.js} +49 -50
  127. package/dist/esm/{f-text-field-e5f1f1fd.js → f-text-field-7b4d622c.js} +38 -4
  128. package/dist/esm/{index-3336c3b1.js → index-99c17b08.js} +157 -40
  129. package/dist/esm/index.js +8 -0
  130. package/dist/esm/ketchup.js +4 -4
  131. package/dist/esm/kup-accordion.entry.js +3 -3
  132. package/dist/esm/kup-autocomplete_27.entry.js +159 -197
  133. package/dist/esm/kup-box.entry.js +23 -15
  134. package/dist/esm/kup-calendar.entry.js +5061 -5028
  135. package/dist/esm/kup-card-list.entry.js +34 -14
  136. package/dist/esm/kup-cell.entry.js +9 -7
  137. package/dist/esm/kup-dashboard.entry.js +6 -6
  138. package/dist/esm/kup-drawer.entry.js +2 -2
  139. package/dist/esm/kup-echart.entry.js +2 -2
  140. package/dist/esm/kup-family-tree.entry.js +4 -4
  141. package/dist/esm/kup-grid.entry.js +2 -2
  142. package/dist/esm/kup-iframe.entry.js +2 -2
  143. package/dist/esm/kup-image-list.entry.js +8 -8
  144. package/dist/esm/kup-lazy.entry.js +2 -2
  145. package/dist/esm/kup-magic-box.entry.js +3 -3
  146. package/dist/esm/kup-manager-9a9d2dbb.js +18604 -0
  147. package/dist/esm/kup-nav-bar.entry.js +2 -2
  148. package/dist/esm/kup-numeric-picker.entry.js +3 -3
  149. package/dist/esm/kup-photo-frame.entry.js +2 -2
  150. package/dist/esm/kup-planner.entry.js +895 -410
  151. package/dist/esm/kup-probe.entry.js +2 -2
  152. package/dist/esm/kup-qlik.entry.js +2 -2
  153. package/dist/esm/kup-snackbar.entry.js +4 -4
  154. package/dist/esm/loader.js +3 -3
  155. package/dist/ketchup/index.esm.js +1 -0
  156. package/dist/ketchup/ketchup.esm.js +1 -1
  157. package/dist/ketchup/{p-a8a39b08.entry.js → p-042e1ed0.entry.js} +1 -1
  158. package/dist/ketchup/{p-55fd3f46.entry.js → p-0dc763af.entry.js} +1 -1
  159. package/dist/ketchup/{p-76130e83.entry.js → p-1ae879af.entry.js} +1 -1
  160. package/dist/ketchup/p-1db0c862.entry.js +1 -0
  161. package/dist/ketchup/{p-25de68e5.js → p-20458088.js} +3 -3
  162. package/dist/ketchup/{p-a0f59b05.entry.js → p-20c1a69f.entry.js} +1 -1
  163. package/dist/ketchup/p-267dd24a.entry.js +9 -0
  164. package/dist/ketchup/{p-39602629.js → p-2849af6f.js} +1 -1
  165. package/dist/ketchup/p-30938d5a.entry.js +1 -0
  166. package/dist/ketchup/{p-f729449f.js → p-34e4a985.js} +1 -1
  167. package/dist/ketchup/p-4067c71b.js +2 -0
  168. package/dist/ketchup/{p-8281c9e5.js → p-4e696daf.js} +1 -1
  169. package/dist/ketchup/p-61f71872.entry.js +1 -0
  170. package/dist/ketchup/p-6a7df3d2.js +1 -0
  171. package/dist/ketchup/{p-2dab9c4f.entry.js → p-6b33f5de.entry.js} +1 -1
  172. package/dist/ketchup/{p-4597f25d.js → p-7a876328.js} +1 -1
  173. package/dist/ketchup/{p-7e1c8fc0.entry.js → p-7f64b612.entry.js} +1 -1
  174. package/dist/ketchup/{p-07707cd1.entry.js → p-90db42e6.entry.js} +1 -1
  175. package/dist/ketchup/{p-13eac183.entry.js → p-9cc1c76b.entry.js} +1 -1
  176. package/dist/ketchup/p-9d3d8690.js +1 -0
  177. package/dist/ketchup/{p-7bf649f0.entry.js → p-b4ba27da.entry.js} +1 -1
  178. package/dist/ketchup/{p-2a2a18bf.entry.js → p-c046fd1c.entry.js} +1 -1
  179. package/dist/ketchup/p-c120043a.entry.js +1 -0
  180. package/dist/ketchup/p-d520d757.entry.js +1 -0
  181. package/dist/ketchup/p-e9bc0749.entry.js +1 -0
  182. package/dist/ketchup/{p-7555c10d.js → p-ea56edbe.js} +1 -1
  183. package/dist/ketchup/p-edd88921.entry.js +1 -0
  184. package/dist/ketchup/{p-da58f8ab.entry.js → p-f1f82eef.entry.js} +1 -1
  185. package/dist/ketchup/{p-51aa248f.entry.js → p-f67ee60f.entry.js} +3 -3
  186. package/dist/ketchup/p-f6844304.entry.js +1 -0
  187. package/dist/ketchup/{p-2d192def.entry.js → p-f8213d22.entry.js} +1 -1
  188. package/dist/types/components/kup-box/kup-box.d.ts +1 -0
  189. package/dist/types/components/kup-card-list/kup-card-list-declarations.d.ts +12 -12
  190. package/dist/types/components/kup-card-list/kup-card-list.d.ts +50 -0
  191. package/dist/types/components/kup-progress-bar/kup-progress-bar.d.ts +0 -1
  192. package/dist/types/components/kup-radio/kup-radio-declarations.d.ts +1 -9
  193. package/dist/types/components/kup-radio/kup-radio.d.ts +3 -2
  194. package/dist/types/components/kup-rating/kup-rating.d.ts +2 -7
  195. package/dist/types/components.d.ts +674 -4
  196. package/dist/types/f-components/f-cell/f-cell-declarations.d.ts +1 -0
  197. package/dist/types/f-components/f-progress-bar/f-progress-bar-declarations.d.ts +16 -0
  198. package/dist/types/f-components/f-progress-bar/f-progress-bar.d.ts +3 -0
  199. package/dist/types/f-components/f-radio/f-radio-declarations.d.ts +22 -0
  200. package/dist/types/f-components/f-radio/f-radio.d.ts +3 -0
  201. package/dist/types/f-components/f-rating/f-rating-declarations.d.ts +10 -0
  202. package/dist/types/f-components/f-rating/f-rating.d.ts +3 -0
  203. package/dist/types/index.d.ts +4 -0
  204. package/dist/types/managers/kup-theme/kup-theme-declarations.d.ts +12 -0
  205. package/dist/types/stencil-public-runtime.d.ts +26 -3
  206. package/dist/types/utils/utils.d.ts +0 -2
  207. package/package.json +3 -3
  208. package/dist/ketchup/p-008ad26c.js +0 -1
  209. package/dist/ketchup/p-0c19d485.entry.js +0 -9
  210. package/dist/ketchup/p-2d42477d.js +0 -2
  211. package/dist/ketchup/p-5c15661d.entry.js +0 -1
  212. package/dist/ketchup/p-5cfaa673.entry.js +0 -1
  213. package/dist/ketchup/p-5f583257.entry.js +0 -1
  214. package/dist/ketchup/p-80699a95.js +0 -1
  215. package/dist/ketchup/p-81debebe.entry.js +0 -1
  216. package/dist/ketchup/p-bb854cf5.entry.js +0 -1
  217. package/dist/ketchup/p-d6a7498b.entry.js +0 -1
  218. package/dist/ketchup/p-d8384990.entry.js +0 -1
  219. package/dist/ketchup/p-ecb9fe91.entry.js +0 -1
@@ -1,5 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host, getAssetPath } from '@stencil/core/internal/client';
2
- import { ay as createCommonjsModule, az as commonjsGlobal, k as kupManagerInstance, aA as KupDatesFormats, aa as getCellValueForDisplay, g as getProps, s as setProps, _ as FTextFieldMDC, c as componentWrapperId, ai as FTextField, a as KupThemeIconValues, $ as KupLanguageSearch, d as defineCustomElement$2, b as defineCustomElement$3, e as defineCustomElement$4, f as defineCustomElement$5, h as defineCustomElement$6, i as defineCustomElement$7, j as defineCustomElement$8, l as defineCustomElement$9, m as defineCustomElement$a, n as defineCustomElement$b, o as defineCustomElement$c, p as defineCustomElement$d, q as defineCustomElement$e, r as defineCustomElement$f, t as defineCustomElement$g, u as defineCustomElement$h, v as defineCustomElement$i, w as defineCustomElement$j, x as defineCustomElement$k, y as defineCustomElement$l, z as defineCustomElement$m, A as defineCustomElement$n, B as defineCustomElement$o, C as defineCustomElement$p, D as defineCustomElement$q, E as defineCustomElement$r, G as defineCustomElement$s } from './kup-autocomplete2.js';
2
+ import { ap as createCommonjsModule, aq as commonjsGlobal, k as kupManagerInstance, r as KupDatesFormats, m as getCellValueForDisplay, g as getProps, s as setProps, b as KupThemeIconValues, W as KupLanguageSearch } from './kup-manager.js';
3
+ import { N as FTextFieldMDC, c as componentWrapperId, _ as FTextField, d as defineCustomElement$2, a as defineCustomElement$3, b as defineCustomElement$4, e as defineCustomElement$5, f as defineCustomElement$6, g as defineCustomElement$7, h as defineCustomElement$8, i as defineCustomElement$9, j as defineCustomElement$a, k as defineCustomElement$b, l as defineCustomElement$c, m as defineCustomElement$d, n as defineCustomElement$e, o as defineCustomElement$f, p as defineCustomElement$g, q as defineCustomElement$h, r as defineCustomElement$i, s as defineCustomElement$j, t as defineCustomElement$k, u as defineCustomElement$l, v as defineCustomElement$m, w as defineCustomElement$n, x as defineCustomElement$o, y as defineCustomElement$p, z as defineCustomElement$q, A as defineCustomElement$r, B as defineCustomElement$s } from './kup-autocomplete2.js';
3
4
 
4
5
  /**
5
6
  * Props of the kup-gantt component.
@@ -1412,6 +1413,17 @@ function systemLocale() {
1412
1413
  return sysLocaleCache;
1413
1414
  }
1414
1415
  }
1416
+ var weekInfoCache = {};
1417
+ function getCachedWeekInfo(locString) {
1418
+ var data = weekInfoCache[locString];
1419
+ if (!data) {
1420
+ var locale = new Intl.Locale(locString);
1421
+ // browsers currently implement this as a property, but spec says it should be a getter function
1422
+ data = "getWeekInfo" in locale ? locale.getWeekInfo() : locale.weekInfo;
1423
+ weekInfoCache[locString] = data;
1424
+ }
1425
+ return data;
1426
+ }
1415
1427
  function parseLocaleString(localeStr) {
1416
1428
  // I really want to avoid writing a BCP 47 parser
1417
1429
  // see, e.g. https://github.com/wooorm/bcp-47
@@ -1467,7 +1479,7 @@ function intlConfigString(localeStr, numberingSystem, outputCalendar) {
1467
1479
  function mapMonths(f) {
1468
1480
  var ms = [];
1469
1481
  for (var i = 1; i <= 12; i++) {
1470
- var dt = DateTime.utc(2016, i, 1);
1482
+ var dt = DateTime.utc(2009, i, 1);
1471
1483
  ms.push(f(dt));
1472
1484
  }
1473
1485
  return ms;
@@ -1480,8 +1492,8 @@ function mapWeekdays(f) {
1480
1492
  }
1481
1493
  return ms;
1482
1494
  }
1483
- function listStuff(loc, length, defaultOK, englishFn, intlFn) {
1484
- var mode = loc.listingMode(defaultOK);
1495
+ function listStuff(loc, length, englishFn, intlFn) {
1496
+ var mode = loc.listingMode();
1485
1497
  if (mode === "error") {
1486
1498
  return null;
1487
1499
  } else if (mode === "en") {
@@ -1643,14 +1655,20 @@ var PolyRelFormatter = /*#__PURE__*/function () {
1643
1655
  };
1644
1656
  return PolyRelFormatter;
1645
1657
  }();
1658
+ var fallbackWeekSettings = {
1659
+ firstDay: 1,
1660
+ minimalDays: 4,
1661
+ weekend: [6, 7]
1662
+ };
1663
+
1646
1664
  /**
1647
1665
  * @private
1648
1666
  */
1649
1667
  var Locale = /*#__PURE__*/function () {
1650
1668
  Locale.fromOpts = function fromOpts(opts) {
1651
- return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
1669
+ return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.weekSettings, opts.defaultToEN);
1652
1670
  };
1653
- Locale.create = function create(locale, numberingSystem, outputCalendar, defaultToEN) {
1671
+ Locale.create = function create(locale, numberingSystem, outputCalendar, weekSettings, defaultToEN) {
1654
1672
  if (defaultToEN === void 0) {
1655
1673
  defaultToEN = false;
1656
1674
  }
@@ -1659,7 +1677,8 @@ var Locale = /*#__PURE__*/function () {
1659
1677
  var localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
1660
1678
  var numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
1661
1679
  var outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
1662
- return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);
1680
+ var weekSettingsR = validateWeekSettings(weekSettings) || Settings.defaultWeekSettings;
1681
+ return new Locale(localeR, numberingSystemR, outputCalendarR, weekSettingsR, specifiedLocale);
1663
1682
  };
1664
1683
  Locale.resetCache = function resetCache() {
1665
1684
  sysLocaleCache = null;
@@ -1671,10 +1690,11 @@ var Locale = /*#__PURE__*/function () {
1671
1690
  var _ref2 = _temp === void 0 ? {} : _temp,
1672
1691
  locale = _ref2.locale,
1673
1692
  numberingSystem = _ref2.numberingSystem,
1674
- outputCalendar = _ref2.outputCalendar;
1675
- return Locale.create(locale, numberingSystem, outputCalendar);
1693
+ outputCalendar = _ref2.outputCalendar,
1694
+ weekSettings = _ref2.weekSettings;
1695
+ return Locale.create(locale, numberingSystem, outputCalendar, weekSettings);
1676
1696
  };
1677
- function Locale(locale, numbering, outputCalendar, specifiedLocale) {
1697
+ function Locale(locale, numbering, outputCalendar, weekSettings, specifiedLocale) {
1678
1698
  var _parseLocaleString = parseLocaleString(locale),
1679
1699
  parsedLocale = _parseLocaleString[0],
1680
1700
  parsedNumberingSystem = _parseLocaleString[1],
@@ -1682,6 +1702,7 @@ var Locale = /*#__PURE__*/function () {
1682
1702
  this.locale = parsedLocale;
1683
1703
  this.numberingSystem = numbering || parsedNumberingSystem || null;
1684
1704
  this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
1705
+ this.weekSettings = weekSettings;
1685
1706
  this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
1686
1707
  this.weekdaysCache = {
1687
1708
  format: {},
@@ -1706,7 +1727,7 @@ var Locale = /*#__PURE__*/function () {
1706
1727
  if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
1707
1728
  return this;
1708
1729
  } else {
1709
- return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false);
1730
+ return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, validateWeekSettings(alts.weekSettings) || this.weekSettings, alts.defaultToEN || false);
1710
1731
  }
1711
1732
  };
1712
1733
  _proto4.redefaultToEN = function redefaultToEN(alts) {
@@ -1725,15 +1746,12 @@ var Locale = /*#__PURE__*/function () {
1725
1746
  defaultToEN: false
1726
1747
  }));
1727
1748
  };
1728
- _proto4.months = function months$1(length, format, defaultOK) {
1749
+ _proto4.months = function months$1(length, format) {
1729
1750
  var _this2 = this;
1730
1751
  if (format === void 0) {
1731
1752
  format = false;
1732
1753
  }
1733
- if (defaultOK === void 0) {
1734
- defaultOK = true;
1735
- }
1736
- return listStuff(this, length, defaultOK, months, function () {
1754
+ return listStuff(this, length, months, function () {
1737
1755
  var intl = format ? {
1738
1756
  month: length,
1739
1757
  day: "numeric"
@@ -1749,15 +1767,12 @@ var Locale = /*#__PURE__*/function () {
1749
1767
  return _this2.monthsCache[formatStr][length];
1750
1768
  });
1751
1769
  };
1752
- _proto4.weekdays = function weekdays$1(length, format, defaultOK) {
1770
+ _proto4.weekdays = function weekdays$1(length, format) {
1753
1771
  var _this3 = this;
1754
1772
  if (format === void 0) {
1755
1773
  format = false;
1756
1774
  }
1757
- if (defaultOK === void 0) {
1758
- defaultOK = true;
1759
- }
1760
- return listStuff(this, length, defaultOK, weekdays, function () {
1775
+ return listStuff(this, length, weekdays, function () {
1761
1776
  var intl = format ? {
1762
1777
  weekday: length,
1763
1778
  year: "numeric",
@@ -1775,12 +1790,9 @@ var Locale = /*#__PURE__*/function () {
1775
1790
  return _this3.weekdaysCache[formatStr][length];
1776
1791
  });
1777
1792
  };
1778
- _proto4.meridiems = function meridiems$1(defaultOK) {
1793
+ _proto4.meridiems = function meridiems$1() {
1779
1794
  var _this4 = this;
1780
- if (defaultOK === void 0) {
1781
- defaultOK = true;
1782
- }
1783
- return listStuff(this, undefined, defaultOK, function () {
1795
+ return listStuff(this, undefined, function () {
1784
1796
  return meridiems;
1785
1797
  }, function () {
1786
1798
  // In theory there could be aribitrary day periods. We're gonna assume there are exactly two
@@ -1797,12 +1809,9 @@ var Locale = /*#__PURE__*/function () {
1797
1809
  return _this4.meridiemCache;
1798
1810
  });
1799
1811
  };
1800
- _proto4.eras = function eras$1(length, defaultOK) {
1812
+ _proto4.eras = function eras$1(length) {
1801
1813
  var _this5 = this;
1802
- if (defaultOK === void 0) {
1803
- defaultOK = true;
1804
- }
1805
- return listStuff(this, length, defaultOK, eras, function () {
1814
+ return listStuff(this, length, eras, function () {
1806
1815
  var intl = {
1807
1816
  era: length
1808
1817
  };
@@ -1854,6 +1863,24 @@ var Locale = /*#__PURE__*/function () {
1854
1863
  _proto4.isEnglish = function isEnglish() {
1855
1864
  return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
1856
1865
  };
1866
+ _proto4.getWeekSettings = function getWeekSettings() {
1867
+ if (this.weekSettings) {
1868
+ return this.weekSettings;
1869
+ } else if (!hasLocaleWeekInfo()) {
1870
+ return fallbackWeekSettings;
1871
+ } else {
1872
+ return getCachedWeekInfo(this.locale);
1873
+ }
1874
+ };
1875
+ _proto4.getStartOfWeek = function getStartOfWeek() {
1876
+ return this.getWeekSettings().firstDay;
1877
+ };
1878
+ _proto4.getMinDaysInFirstWeek = function getMinDaysInFirstWeek() {
1879
+ return this.getWeekSettings().minimalDays;
1880
+ };
1881
+ _proto4.getWeekendDays = function getWeekendDays() {
1882
+ return this.getWeekSettings().weekend;
1883
+ };
1857
1884
  _proto4.equals = function equals(other) {
1858
1885
  return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
1859
1886
  };
@@ -2061,7 +2088,7 @@ function normalizeZone(input, defaultZone) {
2061
2088
  if (lowered === "default") return defaultZone;else if (lowered === "local" || lowered === "system") return SystemZone.instance;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
2062
2089
  } else if (isNumber(input)) {
2063
2090
  return FixedOffsetZone.instance(input);
2064
- } else if (typeof input === "object" && input.offset && typeof input.offset === "number") {
2091
+ } else if (typeof input === "object" && "offset" in input && typeof input.offset === "function") {
2065
2092
  // This is dumb, but the instanceof check above doesn't seem to really work
2066
2093
  // so we're duck checking it
2067
2094
  return input;
@@ -2078,7 +2105,8 @@ var now = function now() {
2078
2105
  defaultNumberingSystem = null,
2079
2106
  defaultOutputCalendar = null,
2080
2107
  twoDigitCutoffYear = 60,
2081
- throwOnInvalid;
2108
+ throwOnInvalid,
2109
+ defaultWeekSettings = null;
2082
2110
 
2083
2111
  /**
2084
2112
  * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here.
@@ -2189,6 +2217,33 @@ var Settings = /*#__PURE__*/function () {
2189
2217
  defaultOutputCalendar = outputCalendar;
2190
2218
  }
2191
2219
 
2220
+ /**
2221
+ * @typedef {Object} WeekSettings
2222
+ * @property {number} firstDay
2223
+ * @property {number} minimalDays
2224
+ * @property {number[]} weekend
2225
+ */
2226
+
2227
+ /**
2228
+ * @return {WeekSettings|null}
2229
+ */
2230
+ }, {
2231
+ key: "defaultWeekSettings",
2232
+ get: function get() {
2233
+ return defaultWeekSettings;
2234
+ }
2235
+
2236
+ /**
2237
+ * Allows overriding the default locale week settings, i.e. the start of the week, the weekend and
2238
+ * how many days are required in the first week of a year.
2239
+ * Does not affect existing instances.
2240
+ *
2241
+ * @param {WeekSettings|null} weekSettings
2242
+ */,
2243
+ set: function set(weekSettings) {
2244
+ defaultWeekSettings = validateWeekSettings(weekSettings);
2245
+ }
2246
+
2192
2247
  /**
2193
2248
  * Get the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
2194
2249
  * @type {number}
@@ -2202,10 +2257,10 @@ var Settings = /*#__PURE__*/function () {
2202
2257
  /**
2203
2258
  * Set the cutoff year after which a string encoding a year as two digits is interpreted to occur in the current century.
2204
2259
  * @type {number}
2205
- * @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpretted as current century
2260
+ * @example Settings.twoDigitCutoffYear = 0 // cut-off year is 0, so all 'yy' are interpreted as current century
2206
2261
  * @example Settings.twoDigitCutoffYear = 50 // '49' -> 1949; '50' -> 2050
2207
- * @example Settings.twoDigitCutoffYear = 1950 // interpretted as 50
2208
- * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpretted as 50
2262
+ * @example Settings.twoDigitCutoffYear = 1950 // interpreted as 50
2263
+ * @example Settings.twoDigitCutoffYear = 2050 // ALSO interpreted as 50
2209
2264
  */,
2210
2265
  set: function set(cutoffYear) {
2211
2266
  twoDigitCutoffYear = cutoffYear % 100;
@@ -2232,6 +2287,230 @@ var Settings = /*#__PURE__*/function () {
2232
2287
  return Settings;
2233
2288
  }();
2234
2289
 
2290
+ var Invalid = /*#__PURE__*/function () {
2291
+ function Invalid(reason, explanation) {
2292
+ this.reason = reason;
2293
+ this.explanation = explanation;
2294
+ }
2295
+ var _proto = Invalid.prototype;
2296
+ _proto.toMessage = function toMessage() {
2297
+ if (this.explanation) {
2298
+ return this.reason + ": " + this.explanation;
2299
+ } else {
2300
+ return this.reason;
2301
+ }
2302
+ };
2303
+ return Invalid;
2304
+ }();
2305
+
2306
+ var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
2307
+ leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
2308
+ function unitOutOfRange(unit, value) {
2309
+ return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid");
2310
+ }
2311
+ function dayOfWeek(year, month, day) {
2312
+ var d = new Date(Date.UTC(year, month - 1, day));
2313
+ if (year < 100 && year >= 0) {
2314
+ d.setUTCFullYear(d.getUTCFullYear() - 1900);
2315
+ }
2316
+ var js = d.getUTCDay();
2317
+ return js === 0 ? 7 : js;
2318
+ }
2319
+ function computeOrdinal(year, month, day) {
2320
+ return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
2321
+ }
2322
+ function uncomputeOrdinal(year, ordinal) {
2323
+ var table = isLeapYear(year) ? leapLadder : nonLeapLadder,
2324
+ month0 = table.findIndex(function (i) {
2325
+ return i < ordinal;
2326
+ }),
2327
+ day = ordinal - table[month0];
2328
+ return {
2329
+ month: month0 + 1,
2330
+ day: day
2331
+ };
2332
+ }
2333
+ function isoWeekdayToLocal(isoWeekday, startOfWeek) {
2334
+ return (isoWeekday - startOfWeek + 7) % 7 + 1;
2335
+ }
2336
+
2337
+ /**
2338
+ * @private
2339
+ */
2340
+
2341
+ function gregorianToWeek(gregObj, minDaysInFirstWeek, startOfWeek) {
2342
+ if (minDaysInFirstWeek === void 0) {
2343
+ minDaysInFirstWeek = 4;
2344
+ }
2345
+ if (startOfWeek === void 0) {
2346
+ startOfWeek = 1;
2347
+ }
2348
+ var year = gregObj.year,
2349
+ month = gregObj.month,
2350
+ day = gregObj.day,
2351
+ ordinal = computeOrdinal(year, month, day),
2352
+ weekday = isoWeekdayToLocal(dayOfWeek(year, month, day), startOfWeek);
2353
+ var weekNumber = Math.floor((ordinal - weekday + 14 - minDaysInFirstWeek) / 7),
2354
+ weekYear;
2355
+ if (weekNumber < 1) {
2356
+ weekYear = year - 1;
2357
+ weekNumber = weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek);
2358
+ } else if (weekNumber > weeksInWeekYear(year, minDaysInFirstWeek, startOfWeek)) {
2359
+ weekYear = year + 1;
2360
+ weekNumber = 1;
2361
+ } else {
2362
+ weekYear = year;
2363
+ }
2364
+ return _extends({
2365
+ weekYear: weekYear,
2366
+ weekNumber: weekNumber,
2367
+ weekday: weekday
2368
+ }, timeObject(gregObj));
2369
+ }
2370
+ function weekToGregorian(weekData, minDaysInFirstWeek, startOfWeek) {
2371
+ if (minDaysInFirstWeek === void 0) {
2372
+ minDaysInFirstWeek = 4;
2373
+ }
2374
+ if (startOfWeek === void 0) {
2375
+ startOfWeek = 1;
2376
+ }
2377
+ var weekYear = weekData.weekYear,
2378
+ weekNumber = weekData.weekNumber,
2379
+ weekday = weekData.weekday,
2380
+ weekdayOfJan4 = isoWeekdayToLocal(dayOfWeek(weekYear, 1, minDaysInFirstWeek), startOfWeek),
2381
+ yearInDays = daysInYear(weekYear);
2382
+ var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 7 + minDaysInFirstWeek,
2383
+ year;
2384
+ if (ordinal < 1) {
2385
+ year = weekYear - 1;
2386
+ ordinal += daysInYear(year);
2387
+ } else if (ordinal > yearInDays) {
2388
+ year = weekYear + 1;
2389
+ ordinal -= daysInYear(weekYear);
2390
+ } else {
2391
+ year = weekYear;
2392
+ }
2393
+ var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal),
2394
+ month = _uncomputeOrdinal.month,
2395
+ day = _uncomputeOrdinal.day;
2396
+ return _extends({
2397
+ year: year,
2398
+ month: month,
2399
+ day: day
2400
+ }, timeObject(weekData));
2401
+ }
2402
+ function gregorianToOrdinal(gregData) {
2403
+ var year = gregData.year,
2404
+ month = gregData.month,
2405
+ day = gregData.day;
2406
+ var ordinal = computeOrdinal(year, month, day);
2407
+ return _extends({
2408
+ year: year,
2409
+ ordinal: ordinal
2410
+ }, timeObject(gregData));
2411
+ }
2412
+ function ordinalToGregorian(ordinalData) {
2413
+ var year = ordinalData.year,
2414
+ ordinal = ordinalData.ordinal;
2415
+ var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal),
2416
+ month = _uncomputeOrdinal2.month,
2417
+ day = _uncomputeOrdinal2.day;
2418
+ return _extends({
2419
+ year: year,
2420
+ month: month,
2421
+ day: day
2422
+ }, timeObject(ordinalData));
2423
+ }
2424
+
2425
+ /**
2426
+ * Check if local week units like localWeekday are used in obj.
2427
+ * If so, validates that they are not mixed with ISO week units and then copies them to the normal week unit properties.
2428
+ * Modifies obj in-place!
2429
+ * @param obj the object values
2430
+ */
2431
+ function usesLocalWeekValues(obj, loc) {
2432
+ var hasLocaleWeekData = !isUndefined(obj.localWeekday) || !isUndefined(obj.localWeekNumber) || !isUndefined(obj.localWeekYear);
2433
+ if (hasLocaleWeekData) {
2434
+ var hasIsoWeekData = !isUndefined(obj.weekday) || !isUndefined(obj.weekNumber) || !isUndefined(obj.weekYear);
2435
+ if (hasIsoWeekData) {
2436
+ throw new ConflictingSpecificationError("Cannot mix locale-based week fields with ISO-based week fields");
2437
+ }
2438
+ if (!isUndefined(obj.localWeekday)) obj.weekday = obj.localWeekday;
2439
+ if (!isUndefined(obj.localWeekNumber)) obj.weekNumber = obj.localWeekNumber;
2440
+ if (!isUndefined(obj.localWeekYear)) obj.weekYear = obj.localWeekYear;
2441
+ delete obj.localWeekday;
2442
+ delete obj.localWeekNumber;
2443
+ delete obj.localWeekYear;
2444
+ return {
2445
+ minDaysInFirstWeek: loc.getMinDaysInFirstWeek(),
2446
+ startOfWeek: loc.getStartOfWeek()
2447
+ };
2448
+ } else {
2449
+ return {
2450
+ minDaysInFirstWeek: 4,
2451
+ startOfWeek: 1
2452
+ };
2453
+ }
2454
+ }
2455
+ function hasInvalidWeekData(obj, minDaysInFirstWeek, startOfWeek) {
2456
+ if (minDaysInFirstWeek === void 0) {
2457
+ minDaysInFirstWeek = 4;
2458
+ }
2459
+ if (startOfWeek === void 0) {
2460
+ startOfWeek = 1;
2461
+ }
2462
+ var validYear = isInteger(obj.weekYear),
2463
+ validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear, minDaysInFirstWeek, startOfWeek)),
2464
+ validWeekday = integerBetween(obj.weekday, 1, 7);
2465
+ if (!validYear) {
2466
+ return unitOutOfRange("weekYear", obj.weekYear);
2467
+ } else if (!validWeek) {
2468
+ return unitOutOfRange("week", obj.weekNumber);
2469
+ } else if (!validWeekday) {
2470
+ return unitOutOfRange("weekday", obj.weekday);
2471
+ } else return false;
2472
+ }
2473
+ function hasInvalidOrdinalData(obj) {
2474
+ var validYear = isInteger(obj.year),
2475
+ validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
2476
+ if (!validYear) {
2477
+ return unitOutOfRange("year", obj.year);
2478
+ } else if (!validOrdinal) {
2479
+ return unitOutOfRange("ordinal", obj.ordinal);
2480
+ } else return false;
2481
+ }
2482
+ function hasInvalidGregorianData(obj) {
2483
+ var validYear = isInteger(obj.year),
2484
+ validMonth = integerBetween(obj.month, 1, 12),
2485
+ validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
2486
+ if (!validYear) {
2487
+ return unitOutOfRange("year", obj.year);
2488
+ } else if (!validMonth) {
2489
+ return unitOutOfRange("month", obj.month);
2490
+ } else if (!validDay) {
2491
+ return unitOutOfRange("day", obj.day);
2492
+ } else return false;
2493
+ }
2494
+ function hasInvalidTimeData(obj) {
2495
+ var hour = obj.hour,
2496
+ minute = obj.minute,
2497
+ second = obj.second,
2498
+ millisecond = obj.millisecond;
2499
+ var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
2500
+ validMinute = integerBetween(minute, 0, 59),
2501
+ validSecond = integerBetween(second, 0, 59),
2502
+ validMillisecond = integerBetween(millisecond, 0, 999);
2503
+ if (!validHour) {
2504
+ return unitOutOfRange("hour", hour);
2505
+ } else if (!validMinute) {
2506
+ return unitOutOfRange("minute", minute);
2507
+ } else if (!validSecond) {
2508
+ return unitOutOfRange("second", second);
2509
+ } else if (!validMillisecond) {
2510
+ return unitOutOfRange("millisecond", millisecond);
2511
+ } else return false;
2512
+ }
2513
+
2235
2514
  /**
2236
2515
  * @private
2237
2516
  */
@@ -2263,6 +2542,13 @@ function hasRelative() {
2263
2542
  return false;
2264
2543
  }
2265
2544
  }
2545
+ function hasLocaleWeekInfo() {
2546
+ try {
2547
+ return typeof Intl !== "undefined" && !!Intl.Locale && ("weekInfo" in Intl.Locale.prototype || "getWeekInfo" in Intl.Locale.prototype);
2548
+ } catch (e) {
2549
+ return false;
2550
+ }
2551
+ }
2266
2552
 
2267
2553
  // OBJECTS AND ARRAYS
2268
2554
 
@@ -2293,6 +2579,24 @@ function pick(obj, keys) {
2293
2579
  function hasOwnProperty(obj, prop) {
2294
2580
  return Object.prototype.hasOwnProperty.call(obj, prop);
2295
2581
  }
2582
+ function validateWeekSettings(settings) {
2583
+ if (settings == null) {
2584
+ return null;
2585
+ } else if (typeof settings !== "object") {
2586
+ throw new InvalidArgumentError("Week settings must be an object");
2587
+ } else {
2588
+ if (!integerBetween(settings.firstDay, 1, 7) || !integerBetween(settings.minimalDays, 1, 7) || !Array.isArray(settings.weekend) || settings.weekend.some(function (v) {
2589
+ return !integerBetween(v, 1, 7);
2590
+ })) {
2591
+ throw new InvalidArgumentError("Invalid week settings");
2592
+ }
2593
+ return {
2594
+ firstDay: settings.firstDay,
2595
+ minimalDays: settings.minimalDays,
2596
+ weekend: Array.from(settings.weekend)
2597
+ };
2598
+ }
2599
+ }
2296
2600
 
2297
2601
  // NUMBERS AND STRINGS
2298
2602
 
@@ -2367,7 +2671,7 @@ function daysInMonth(year, month) {
2367
2671
  }
2368
2672
  }
2369
2673
 
2370
- // covert a calendar object to a local timestamp (epoch, but with the offset baked in)
2674
+ // convert a calendar object to a local timestamp (epoch, but with the offset baked in)
2371
2675
  function objToLocalTS(obj) {
2372
2676
  var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond);
2373
2677
 
@@ -2381,11 +2685,22 @@ function objToLocalTS(obj) {
2381
2685
  }
2382
2686
  return +d;
2383
2687
  }
2384
- function weeksInWeekYear(weekYear) {
2385
- var p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7,
2386
- last = weekYear - 1,
2387
- p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;
2388
- return p1 === 4 || p2 === 3 ? 53 : 52;
2688
+
2689
+ // adapted from moment.js: https://github.com/moment/moment/blob/000ac1800e620f770f4eb31b5ae908f6167b0ab2/src/lib/units/week-calendar-utils.js
2690
+ function firstWeekOffset(year, minDaysInFirstWeek, startOfWeek) {
2691
+ var fwdlw = isoWeekdayToLocal(dayOfWeek(year, 1, minDaysInFirstWeek), startOfWeek);
2692
+ return -fwdlw + minDaysInFirstWeek - 1;
2693
+ }
2694
+ function weeksInWeekYear(weekYear, minDaysInFirstWeek, startOfWeek) {
2695
+ if (minDaysInFirstWeek === void 0) {
2696
+ minDaysInFirstWeek = 4;
2697
+ }
2698
+ if (startOfWeek === void 0) {
2699
+ startOfWeek = 1;
2700
+ }
2701
+ var weekOffset = firstWeekOffset(weekYear, minDaysInFirstWeek, startOfWeek);
2702
+ var weekOffsetNext = firstWeekOffset(weekYear + 1, minDaysInFirstWeek, startOfWeek);
2703
+ return (daysInYear(weekYear) - weekOffset + weekOffsetNext) / 7;
2389
2704
  }
2390
2705
  function untruncateYear(year) {
2391
2706
  if (year > 99) {
@@ -2680,33 +2995,24 @@ var Formatter = /*#__PURE__*/function () {
2680
2995
  var df = this.systemLoc.dtFormatter(dt, _extends({}, this.opts, opts));
2681
2996
  return df.format();
2682
2997
  };
2683
- _proto.formatDateTime = function formatDateTime(dt, opts) {
2998
+ _proto.dtFormatter = function dtFormatter(dt, opts) {
2684
2999
  if (opts === void 0) {
2685
3000
  opts = {};
2686
3001
  }
2687
- var df = this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
2688
- return df.format();
3002
+ return this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
3003
+ };
3004
+ _proto.formatDateTime = function formatDateTime(dt, opts) {
3005
+ return this.dtFormatter(dt, opts).format();
2689
3006
  };
2690
3007
  _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) {
2691
- if (opts === void 0) {
2692
- opts = {};
2693
- }
2694
- var df = this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
2695
- return df.formatToParts();
3008
+ return this.dtFormatter(dt, opts).formatToParts();
2696
3009
  };
2697
3010
  _proto.formatInterval = function formatInterval(interval, opts) {
2698
- if (opts === void 0) {
2699
- opts = {};
2700
- }
2701
- var df = this.loc.dtFormatter(interval.start, _extends({}, this.opts, opts));
3011
+ var df = this.dtFormatter(interval.start, opts);
2702
3012
  return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
2703
3013
  };
2704
3014
  _proto.resolvedOptions = function resolvedOptions(dt, opts) {
2705
- if (opts === void 0) {
2706
- opts = {};
2707
- }
2708
- var df = this.loc.dtFormatter(dt, _extends({}, this.opts, opts));
2709
- return df.resolvedOptions();
3015
+ return this.dtFormatter(dt, opts).resolvedOptions();
2710
3016
  };
2711
3017
  _proto.num = function num(n, p) {
2712
3018
  if (p === void 0) {
@@ -2772,7 +3078,7 @@ var Formatter = /*#__PURE__*/function () {
2772
3078
  }, "era");
2773
3079
  },
2774
3080
  tokenToString = function tokenToString(token) {
2775
- // Where possible: http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles
3081
+ // Where possible: https://cldr.unicode.org/translation/date-time/date-time-symbols
2776
3082
  switch (token) {
2777
3083
  // ms
2778
3084
  case "S":
@@ -2958,6 +3264,14 @@ var Formatter = /*#__PURE__*/function () {
2958
3264
  return _this.num(dt.weekNumber);
2959
3265
  case "WW":
2960
3266
  return _this.num(dt.weekNumber, 2);
3267
+ case "n":
3268
+ return _this.num(dt.localWeekNumber);
3269
+ case "nn":
3270
+ return _this.num(dt.localWeekNumber, 2);
3271
+ case "ii":
3272
+ return _this.num(dt.localWeekYear.toString().slice(-2), 2);
3273
+ case "iiii":
3274
+ return _this.num(dt.localWeekYear, 4);
2961
3275
  case "o":
2962
3276
  return _this.num(dt.ordinal);
2963
3277
  case "ooo":
@@ -3026,22 +3340,6 @@ var Formatter = /*#__PURE__*/function () {
3026
3340
  return Formatter;
3027
3341
  }();
3028
3342
 
3029
- var Invalid = /*#__PURE__*/function () {
3030
- function Invalid(reason, explanation) {
3031
- this.reason = reason;
3032
- this.explanation = explanation;
3033
- }
3034
- var _proto = Invalid.prototype;
3035
- _proto.toMessage = function toMessage() {
3036
- if (this.explanation) {
3037
- return this.reason + ": " + this.explanation;
3038
- } else {
3039
- return this.reason;
3040
- }
3041
- };
3042
- return Invalid;
3043
- }();
3044
-
3045
3343
  /*
3046
3344
  * This file handles parsing for well-specified formats. Here's how it works:
3047
3345
  * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match.
@@ -3425,27 +3723,62 @@ function clone$1(dur, alts, clear) {
3425
3723
  };
3426
3724
  return new Duration(conf);
3427
3725
  }
3428
- function antiTrunc(n) {
3429
- return n < 0 ? Math.floor(n) : Math.ceil(n);
3430
- }
3431
-
3432
- // NB: mutates parameters
3433
- function convert(matrix, fromMap, fromUnit, toMap, toUnit) {
3434
- var conv = matrix[toUnit][fromUnit],
3435
- raw = fromMap[fromUnit] / conv,
3436
- sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]),
3437
- // ok, so this is wild, but see the matrix in the tests
3438
- added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);
3439
- toMap[toUnit] += added;
3440
- fromMap[fromUnit] -= added * conv;
3726
+ function durationToMillis(matrix, vals) {
3727
+ var _vals$milliseconds;
3728
+ var sum = (_vals$milliseconds = vals.milliseconds) != null ? _vals$milliseconds : 0;
3729
+ for (var _iterator = _createForOfIteratorHelperLoose(reverseUnits.slice(1)), _step; !(_step = _iterator()).done;) {
3730
+ var unit = _step.value;
3731
+ if (vals[unit]) {
3732
+ sum += vals[unit] * matrix[unit]["milliseconds"];
3733
+ }
3734
+ }
3735
+ return sum;
3441
3736
  }
3442
3737
 
3443
3738
  // NB: mutates parameters
3444
3739
  function normalizeValues(matrix, vals) {
3445
- reverseUnits.reduce(function (previous, current) {
3740
+ // the logic below assumes the overall value of the duration is positive
3741
+ // if this is not the case, factor is used to make it so
3742
+ var factor = durationToMillis(matrix, vals) < 0 ? -1 : 1;
3743
+ orderedUnits$1.reduceRight(function (previous, current) {
3446
3744
  if (!isUndefined(vals[current])) {
3447
3745
  if (previous) {
3448
- convert(matrix, vals, previous, vals, current);
3746
+ var previousVal = vals[previous] * factor;
3747
+ var conv = matrix[current][previous];
3748
+
3749
+ // if (previousVal < 0):
3750
+ // lower order unit is negative (e.g. { years: 2, days: -2 })
3751
+ // normalize this by reducing the higher order unit by the appropriate amount
3752
+ // and increasing the lower order unit
3753
+ // this can never make the higher order unit negative, because this function only operates
3754
+ // on positive durations, so the amount of time represented by the lower order unit cannot
3755
+ // be larger than the higher order unit
3756
+ // else:
3757
+ // lower order unit is positive (e.g. { years: 2, days: 450 } or { years: -2, days: 450 })
3758
+ // in this case we attempt to convert as much as possible from the lower order unit into
3759
+ // the higher order one
3760
+ //
3761
+ // Math.floor takes care of both of these cases, rounding away from 0
3762
+ // if previousVal < 0 it makes the absolute value larger
3763
+ // if previousVal >= it makes the absolute value smaller
3764
+ var rollUp = Math.floor(previousVal / conv);
3765
+ vals[current] += rollUp * factor;
3766
+ vals[previous] -= rollUp * conv * factor;
3767
+ }
3768
+ return current;
3769
+ } else {
3770
+ return previous;
3771
+ }
3772
+ }, null);
3773
+
3774
+ // try to convert any decimals into smaller units if possible
3775
+ // for example for { years: 2.5, days: 0, seconds: 0 } we want to get { years: 2, days: 182, hours: 12 }
3776
+ orderedUnits$1.reduce(function (previous, current) {
3777
+ if (!isUndefined(vals[current])) {
3778
+ if (previous) {
3779
+ var fraction = vals[previous] % 1;
3780
+ vals[previous] -= fraction;
3781
+ vals[current] += fraction * matrix[previous][current];
3449
3782
  }
3450
3783
  return current;
3451
3784
  } else {
@@ -3481,7 +3814,7 @@ function removeZeroes(vals) {
3481
3814
  *
3482
3815
  * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation.
3483
3816
  */
3484
- var Duration = /*#__PURE__*/function () {
3817
+ var Duration = /*#__PURE__*/function (_Symbol$for) {
3485
3818
  /**
3486
3819
  * @private
3487
3820
  */
@@ -3740,9 +4073,10 @@ var Duration = /*#__PURE__*/function () {
3740
4073
 
3741
4074
  /**
3742
4075
  * Returns a string representation of a Duration with all units included.
3743
- * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
3744
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
3745
- * @param opts - On option object to override the formatting. Accepts the same keys as the options parameter of the native `Int.NumberFormat` constructor, as well as `listStyle`.
4076
+ * To modify its behavior, use `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
4077
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
4078
+ * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
4079
+ * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.
3746
4080
  * @example
3747
4081
  * ```js
3748
4082
  * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
@@ -3756,6 +4090,7 @@ var Duration = /*#__PURE__*/function () {
3756
4090
  if (opts === void 0) {
3757
4091
  opts = {};
3758
4092
  }
4093
+ if (!this.isValid) return INVALID$2;
3759
4094
  var l = orderedUnits$1.map(function (unit) {
3760
4095
  var val = _this.values[unit];
3761
4096
  if (isUndefined(val)) {
@@ -3843,20 +4178,13 @@ var Duration = /*#__PURE__*/function () {
3843
4178
  suppressSeconds: false,
3844
4179
  includePrefix: false,
3845
4180
  format: "extended"
3846
- }, opts);
3847
- var value = this.shiftTo("hours", "minutes", "seconds", "milliseconds");
3848
- var fmt = opts.format === "basic" ? "hhmm" : "hh:mm";
3849
- if (!opts.suppressSeconds || value.seconds !== 0 || value.milliseconds !== 0) {
3850
- fmt += opts.format === "basic" ? "ss" : ":ss";
3851
- if (!opts.suppressMilliseconds || value.milliseconds !== 0) {
3852
- fmt += ".SSS";
3853
- }
3854
- }
3855
- var str = value.toFormat(fmt);
3856
- if (opts.includePrefix) {
3857
- str = "T" + str;
3858
- }
3859
- return str;
4181
+ }, opts, {
4182
+ includeOffset: false
4183
+ });
4184
+ var dateTime = DateTime.fromMillis(millis, {
4185
+ zone: "UTC"
4186
+ });
4187
+ return dateTime.toISOTime(opts);
3860
4188
  }
3861
4189
 
3862
4190
  /**
@@ -3875,12 +4203,25 @@ var Duration = /*#__PURE__*/function () {
3875
4203
  return this.toISO();
3876
4204
  }
3877
4205
 
4206
+ /**
4207
+ * Returns a string representation of this Duration appropriate for the REPL.
4208
+ * @return {string}
4209
+ */;
4210
+ _proto[_Symbol$for] = function () {
4211
+ if (this.isValid) {
4212
+ return "Duration { values: " + JSON.stringify(this.values) + " }";
4213
+ } else {
4214
+ return "Duration { Invalid, reason: " + this.invalidReason + " }";
4215
+ }
4216
+ }
4217
+
3878
4218
  /**
3879
4219
  * Returns an milliseconds value of this Duration.
3880
4220
  * @return {number}
3881
4221
  */;
3882
4222
  _proto.toMillis = function toMillis() {
3883
- return this.as("milliseconds");
4223
+ if (!this.isValid) return NaN;
4224
+ return durationToMillis(this.matrix, this.values);
3884
4225
  }
3885
4226
 
3886
4227
  /**
@@ -4005,8 +4346,17 @@ var Duration = /*#__PURE__*/function () {
4005
4346
 
4006
4347
  /**
4007
4348
  * Reduce this Duration to its canonical representation in its current units.
4349
+ * Assuming the overall value of the Duration is positive, this means:
4350
+ * - excessive values for lower-order units are converted to higher-order units (if possible, see first and second example)
4351
+ * - negative lower-order units are converted to higher order units (there must be such a higher order unit, otherwise
4352
+ * the overall value would be negative, see third example)
4353
+ * - fractional values for higher-order units are converted to lower-order units (if possible, see fourth example)
4354
+ *
4355
+ * If the overall value is negative, the result of this method is equivalent to `this.negate().normalize().negate()`.
4008
4356
  * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 }
4357
+ * @example Duration.fromObject({ days: 5000 }).normalize().toObject() //=> { days: 5000 }
4009
4358
  * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 }
4359
+ * @example Duration.fromObject({ years: 2.5, days: 0, hours: 0 }).normalize().toObject() //=> { years: 2, days: 182, hours: 12 }
4010
4360
  * @return {Duration}
4011
4361
  */;
4012
4362
  _proto.normalize = function normalize() {
@@ -4067,16 +4417,13 @@ var Duration = /*#__PURE__*/function () {
4067
4417
  if (isNumber(vals[k])) {
4068
4418
  own += vals[k];
4069
4419
  }
4420
+
4421
+ // only keep the integer part for now in the hopes of putting any decimal part
4422
+ // into a smaller unit later
4070
4423
  var i = Math.trunc(own);
4071
4424
  built[k] = i;
4072
4425
  accumulated[k] = (own * 1000 - i * 1000) / 1000;
4073
4426
 
4074
- // plus anything further down the chain that should be rolled up in to this
4075
- for (var down in vals) {
4076
- if (orderedUnits$1.indexOf(down) > orderedUnits$1.indexOf(k)) {
4077
- convert(this.matrix, vals, down, built, k);
4078
- }
4079
- }
4080
4427
  // otherwise, keep it in the wings to boil it later
4081
4428
  } else if (isNumber(vals[k])) {
4082
4429
  accumulated[k] = vals[k];
@@ -4090,9 +4437,10 @@ var Duration = /*#__PURE__*/function () {
4090
4437
  built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
4091
4438
  }
4092
4439
  }
4440
+ normalizeValues(this.matrix, built);
4093
4441
  return clone$1(this, {
4094
4442
  values: built
4095
- }, true).normalize();
4443
+ }, true);
4096
4444
  }
4097
4445
 
4098
4446
  /**
@@ -4286,7 +4634,7 @@ var Duration = /*#__PURE__*/function () {
4286
4634
  }
4287
4635
  }]);
4288
4636
  return Duration;
4289
- }();
4637
+ }(Symbol.for("nodejs.util.inspect.custom"));
4290
4638
 
4291
4639
  var INVALID$1 = "Invalid Interval";
4292
4640
 
@@ -4315,7 +4663,7 @@ function validateStartEnd(start, end) {
4315
4663
  * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}
4316
4664
  * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toLocaleString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.
4317
4665
  */
4318
- var Interval = /*#__PURE__*/function () {
4666
+ var Interval = /*#__PURE__*/function (_Symbol$for) {
4319
4667
  /**
4320
4668
  * @private
4321
4669
  */
@@ -4481,15 +4829,25 @@ var Interval = /*#__PURE__*/function () {
4481
4829
  * Unlike {@link Interval#length} this counts sections of the calendar, not periods of time, e.g. specifying 'day'
4482
4830
  * asks 'what dates are included in this interval?', not 'how many days long is this interval?'
4483
4831
  * @param {string} [unit='milliseconds'] - the unit of time to count.
4832
+ * @param {Object} opts - options
4833
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; this operation will always use the locale of the start DateTime
4484
4834
  * @return {number}
4485
4835
  */;
4486
- _proto.count = function count(unit) {
4836
+ _proto.count = function count(unit, opts) {
4487
4837
  if (unit === void 0) {
4488
4838
  unit = "milliseconds";
4489
4839
  }
4490
4840
  if (!this.isValid) return NaN;
4491
- var start = this.start.startOf(unit),
4492
- end = this.end.startOf(unit);
4841
+ var start = this.start.startOf(unit, opts);
4842
+ var end;
4843
+ if (opts != null && opts.useLocaleWeeks) {
4844
+ end = this.end.reconfigure({
4845
+ locale: start.locale
4846
+ });
4847
+ } else {
4848
+ end = this.end;
4849
+ }
4850
+ end = end.startOf(unit, opts);
4493
4851
  return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
4494
4852
  }
4495
4853
 
@@ -4568,7 +4926,9 @@ var Interval = /*#__PURE__*/function () {
4568
4926
  }
4569
4927
  var sorted = dateTimes.map(friendlyDateTime).filter(function (d) {
4570
4928
  return _this.contains(d);
4571
- }).sort(),
4929
+ }).sort(function (a, b) {
4930
+ return a.toMillis() - b.toMillis();
4931
+ }),
4572
4932
  results = [];
4573
4933
  var s = this.s,
4574
4934
  i = 0;
@@ -4793,6 +5153,18 @@ var Interval = /*#__PURE__*/function () {
4793
5153
  return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")";
4794
5154
  }
4795
5155
 
5156
+ /**
5157
+ * Returns a string representation of this Interval appropriate for the REPL.
5158
+ * @return {string}
5159
+ */;
5160
+ _proto[_Symbol$for] = function () {
5161
+ if (this.isValid) {
5162
+ return "Interval { start: " + this.s.toISO() + ", end: " + this.e.toISO() + " }";
5163
+ } else {
5164
+ return "Interval { Invalid, reason: " + this.invalidReason + " }";
5165
+ }
5166
+ }
5167
+
4796
5168
  /**
4797
5169
  * Returns a localized string representing this Interval. Accepts the same options as the
4798
5170
  * Intl.DateTimeFormat constructor and any presets defined by Luxon, such as
@@ -4950,7 +5322,7 @@ var Interval = /*#__PURE__*/function () {
4950
5322
  }
4951
5323
  }]);
4952
5324
  return Interval;
4953
- }();
5325
+ }(Symbol.for("nodejs.util.inspect.custom"));
4954
5326
 
4955
5327
  /**
4956
5328
  * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment.
@@ -5001,6 +5373,56 @@ var Info = /*#__PURE__*/function () {
5001
5373
  return normalizeZone(input, Settings.defaultZone);
5002
5374
  }
5003
5375
 
5376
+ /**
5377
+ * Get the weekday on which the week starts according to the given locale.
5378
+ * @param {Object} opts - options
5379
+ * @param {string} [opts.locale] - the locale code
5380
+ * @param {string} [opts.locObj=null] - an existing locale object to use
5381
+ * @returns {number} the start of the week, 1 for Monday through 7 for Sunday
5382
+ */;
5383
+ Info.getStartOfWeek = function getStartOfWeek(_temp) {
5384
+ var _ref = _temp === void 0 ? {} : _temp,
5385
+ _ref$locale = _ref.locale,
5386
+ locale = _ref$locale === void 0 ? null : _ref$locale,
5387
+ _ref$locObj = _ref.locObj,
5388
+ locObj = _ref$locObj === void 0 ? null : _ref$locObj;
5389
+ return (locObj || Locale.create(locale)).getStartOfWeek();
5390
+ }
5391
+
5392
+ /**
5393
+ * Get the minimum number of days necessary in a week before it is considered part of the next year according
5394
+ * to the given locale.
5395
+ * @param {Object} opts - options
5396
+ * @param {string} [opts.locale] - the locale code
5397
+ * @param {string} [opts.locObj=null] - an existing locale object to use
5398
+ * @returns {number}
5399
+ */;
5400
+ Info.getMinimumDaysInFirstWeek = function getMinimumDaysInFirstWeek(_temp2) {
5401
+ var _ref2 = _temp2 === void 0 ? {} : _temp2,
5402
+ _ref2$locale = _ref2.locale,
5403
+ locale = _ref2$locale === void 0 ? null : _ref2$locale,
5404
+ _ref2$locObj = _ref2.locObj,
5405
+ locObj = _ref2$locObj === void 0 ? null : _ref2$locObj;
5406
+ return (locObj || Locale.create(locale)).getMinDaysInFirstWeek();
5407
+ }
5408
+
5409
+ /**
5410
+ * Get the weekdays, which are considered the weekend according to the given locale
5411
+ * @param {Object} opts - options
5412
+ * @param {string} [opts.locale] - the locale code
5413
+ * @param {string} [opts.locObj=null] - an existing locale object to use
5414
+ * @returns {number[]} an array of weekdays, 1 for Monday through 7 for Sunday
5415
+ */;
5416
+ Info.getWeekendWeekdays = function getWeekendWeekdays(_temp3) {
5417
+ var _ref3 = _temp3 === void 0 ? {} : _temp3,
5418
+ _ref3$locale = _ref3.locale,
5419
+ locale = _ref3$locale === void 0 ? null : _ref3$locale,
5420
+ _ref3$locObj = _ref3.locObj,
5421
+ locObj = _ref3$locObj === void 0 ? null : _ref3$locObj;
5422
+ // copy the array, because we cache it internally
5423
+ return (locObj || Locale.create(locale)).getWeekendDays().slice();
5424
+ }
5425
+
5004
5426
  /**
5005
5427
  * Return an array of standalone month names.
5006
5428
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
@@ -5018,19 +5440,19 @@ var Info = /*#__PURE__*/function () {
5018
5440
  * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I'
5019
5441
  * @return {Array}
5020
5442
  */;
5021
- Info.months = function months(length, _temp) {
5443
+ Info.months = function months(length, _temp4) {
5022
5444
  if (length === void 0) {
5023
5445
  length = "long";
5024
5446
  }
5025
- var _ref = _temp === void 0 ? {} : _temp,
5026
- _ref$locale = _ref.locale,
5027
- locale = _ref$locale === void 0 ? null : _ref$locale,
5028
- _ref$numberingSystem = _ref.numberingSystem,
5029
- numberingSystem = _ref$numberingSystem === void 0 ? null : _ref$numberingSystem,
5030
- _ref$locObj = _ref.locObj,
5031
- locObj = _ref$locObj === void 0 ? null : _ref$locObj,
5032
- _ref$outputCalendar = _ref.outputCalendar,
5033
- outputCalendar = _ref$outputCalendar === void 0 ? "gregory" : _ref$outputCalendar;
5447
+ var _ref4 = _temp4 === void 0 ? {} : _temp4,
5448
+ _ref4$locale = _ref4.locale,
5449
+ locale = _ref4$locale === void 0 ? null : _ref4$locale,
5450
+ _ref4$numberingSystem = _ref4.numberingSystem,
5451
+ numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem,
5452
+ _ref4$locObj = _ref4.locObj,
5453
+ locObj = _ref4$locObj === void 0 ? null : _ref4$locObj,
5454
+ _ref4$outputCalendar = _ref4.outputCalendar,
5455
+ outputCalendar = _ref4$outputCalendar === void 0 ? "gregory" : _ref4$outputCalendar;
5034
5456
  return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
5035
5457
  }
5036
5458
 
@@ -5047,19 +5469,19 @@ var Info = /*#__PURE__*/function () {
5047
5469
  * @param {string} [opts.outputCalendar='gregory'] - the calendar
5048
5470
  * @return {Array}
5049
5471
  */;
5050
- Info.monthsFormat = function monthsFormat(length, _temp2) {
5472
+ Info.monthsFormat = function monthsFormat(length, _temp5) {
5051
5473
  if (length === void 0) {
5052
5474
  length = "long";
5053
5475
  }
5054
- var _ref2 = _temp2 === void 0 ? {} : _temp2,
5055
- _ref2$locale = _ref2.locale,
5056
- locale = _ref2$locale === void 0 ? null : _ref2$locale,
5057
- _ref2$numberingSystem = _ref2.numberingSystem,
5058
- numberingSystem = _ref2$numberingSystem === void 0 ? null : _ref2$numberingSystem,
5059
- _ref2$locObj = _ref2.locObj,
5060
- locObj = _ref2$locObj === void 0 ? null : _ref2$locObj,
5061
- _ref2$outputCalendar = _ref2.outputCalendar,
5062
- outputCalendar = _ref2$outputCalendar === void 0 ? "gregory" : _ref2$outputCalendar;
5476
+ var _ref5 = _temp5 === void 0 ? {} : _temp5,
5477
+ _ref5$locale = _ref5.locale,
5478
+ locale = _ref5$locale === void 0 ? null : _ref5$locale,
5479
+ _ref5$numberingSystem = _ref5.numberingSystem,
5480
+ numberingSystem = _ref5$numberingSystem === void 0 ? null : _ref5$numberingSystem,
5481
+ _ref5$locObj = _ref5.locObj,
5482
+ locObj = _ref5$locObj === void 0 ? null : _ref5$locObj,
5483
+ _ref5$outputCalendar = _ref5.outputCalendar,
5484
+ outputCalendar = _ref5$outputCalendar === void 0 ? "gregory" : _ref5$outputCalendar;
5063
5485
  return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
5064
5486
  }
5065
5487
 
@@ -5077,17 +5499,17 @@ var Info = /*#__PURE__*/function () {
5077
5499
  * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين'
5078
5500
  * @return {Array}
5079
5501
  */;
5080
- Info.weekdays = function weekdays(length, _temp3) {
5502
+ Info.weekdays = function weekdays(length, _temp6) {
5081
5503
  if (length === void 0) {
5082
5504
  length = "long";
5083
5505
  }
5084
- var _ref3 = _temp3 === void 0 ? {} : _temp3,
5085
- _ref3$locale = _ref3.locale,
5086
- locale = _ref3$locale === void 0 ? null : _ref3$locale,
5087
- _ref3$numberingSystem = _ref3.numberingSystem,
5088
- numberingSystem = _ref3$numberingSystem === void 0 ? null : _ref3$numberingSystem,
5089
- _ref3$locObj = _ref3.locObj,
5090
- locObj = _ref3$locObj === void 0 ? null : _ref3$locObj;
5506
+ var _ref6 = _temp6 === void 0 ? {} : _temp6,
5507
+ _ref6$locale = _ref6.locale,
5508
+ locale = _ref6$locale === void 0 ? null : _ref6$locale,
5509
+ _ref6$numberingSystem = _ref6.numberingSystem,
5510
+ numberingSystem = _ref6$numberingSystem === void 0 ? null : _ref6$numberingSystem,
5511
+ _ref6$locObj = _ref6.locObj,
5512
+ locObj = _ref6$locObj === void 0 ? null : _ref6$locObj;
5091
5513
  return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
5092
5514
  }
5093
5515
 
@@ -5103,17 +5525,17 @@ var Info = /*#__PURE__*/function () {
5103
5525
  * @param {string} [opts.locObj=null] - an existing locale object to use
5104
5526
  * @return {Array}
5105
5527
  */;
5106
- Info.weekdaysFormat = function weekdaysFormat(length, _temp4) {
5528
+ Info.weekdaysFormat = function weekdaysFormat(length, _temp7) {
5107
5529
  if (length === void 0) {
5108
5530
  length = "long";
5109
5531
  }
5110
- var _ref4 = _temp4 === void 0 ? {} : _temp4,
5111
- _ref4$locale = _ref4.locale,
5112
- locale = _ref4$locale === void 0 ? null : _ref4$locale,
5113
- _ref4$numberingSystem = _ref4.numberingSystem,
5114
- numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem,
5115
- _ref4$locObj = _ref4.locObj,
5116
- locObj = _ref4$locObj === void 0 ? null : _ref4$locObj;
5532
+ var _ref7 = _temp7 === void 0 ? {} : _temp7,
5533
+ _ref7$locale = _ref7.locale,
5534
+ locale = _ref7$locale === void 0 ? null : _ref7$locale,
5535
+ _ref7$numberingSystem = _ref7.numberingSystem,
5536
+ numberingSystem = _ref7$numberingSystem === void 0 ? null : _ref7$numberingSystem,
5537
+ _ref7$locObj = _ref7.locObj,
5538
+ locObj = _ref7$locObj === void 0 ? null : _ref7$locObj;
5117
5539
  return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
5118
5540
  }
5119
5541
 
@@ -5125,10 +5547,10 @@ var Info = /*#__PURE__*/function () {
5125
5547
  * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ]
5126
5548
  * @return {Array}
5127
5549
  */;
5128
- Info.meridiems = function meridiems(_temp5) {
5129
- var _ref5 = _temp5 === void 0 ? {} : _temp5,
5130
- _ref5$locale = _ref5.locale,
5131
- locale = _ref5$locale === void 0 ? null : _ref5$locale;
5550
+ Info.meridiems = function meridiems(_temp8) {
5551
+ var _ref8 = _temp8 === void 0 ? {} : _temp8,
5552
+ _ref8$locale = _ref8.locale,
5553
+ locale = _ref8$locale === void 0 ? null : _ref8$locale;
5132
5554
  return Locale.create(locale).meridiems();
5133
5555
  }
5134
5556
 
@@ -5142,13 +5564,13 @@ var Info = /*#__PURE__*/function () {
5142
5564
  * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ]
5143
5565
  * @return {Array}
5144
5566
  */;
5145
- Info.eras = function eras(length, _temp6) {
5567
+ Info.eras = function eras(length, _temp9) {
5146
5568
  if (length === void 0) {
5147
5569
  length = "short";
5148
5570
  }
5149
- var _ref6 = _temp6 === void 0 ? {} : _temp6,
5150
- _ref6$locale = _ref6.locale,
5151
- locale = _ref6$locale === void 0 ? null : _ref6$locale;
5571
+ var _ref9 = _temp9 === void 0 ? {} : _temp9,
5572
+ _ref9$locale = _ref9.locale,
5573
+ locale = _ref9$locale === void 0 ? null : _ref9$locale;
5152
5574
  return Locale.create(locale, null, "gregory").eras(length);
5153
5575
  }
5154
5576
 
@@ -5157,12 +5579,14 @@ var Info = /*#__PURE__*/function () {
5157
5579
  * Some features of Luxon are not available in all environments. For example, on older browsers, relative time formatting support is not available. Use this function to figure out if that's the case.
5158
5580
  * Keys:
5159
5581
  * * `relative`: whether this environment supports relative time formatting
5160
- * @example Info.features() //=> { relative: false }
5582
+ * * `localeWeek`: whether this environment supports different weekdays for the start of the week based on the locale
5583
+ * @example Info.features() //=> { relative: false, localeWeek: true }
5161
5584
  * @return {Object}
5162
5585
  */;
5163
5586
  Info.features = function features() {
5164
5587
  return {
5165
- relative: hasRelative()
5588
+ relative: hasRelative(),
5589
+ localeWeek: hasLocaleWeekInfo()
5166
5590
  };
5167
5591
  };
5168
5592
  return Info;
@@ -5191,6 +5615,15 @@ function highOrderDiffs(cursor, later, units) {
5191
5615
  var results = {};
5192
5616
  var earlier = cursor;
5193
5617
  var lowestOrder, highWater;
5618
+
5619
+ /* This loop tries to diff using larger units first.
5620
+ If we overshoot, we backtrack and try the next smaller unit.
5621
+ "cursor" starts out at the earlier timestamp and moves closer and closer to "later"
5622
+ as we use smaller and smaller units.
5623
+ highWater keeps track of where we would be if we added one more of the smallest unit,
5624
+ this is used later to potentially convert any difference smaller than the smallest higher order unit
5625
+ into a fraction of that smallest higher order unit
5626
+ */
5194
5627
  for (var _i = 0, _differs = differs; _i < _differs.length; _i++) {
5195
5628
  var _differs$_i = _differs[_i],
5196
5629
  unit = _differs$_i[0],
@@ -5200,8 +5633,20 @@ function highOrderDiffs(cursor, later, units) {
5200
5633
  results[unit] = differ(cursor, later);
5201
5634
  highWater = earlier.plus(results);
5202
5635
  if (highWater > later) {
5636
+ // we overshot the end point, backtrack cursor by 1
5203
5637
  results[unit]--;
5204
5638
  cursor = earlier.plus(results);
5639
+
5640
+ // if we are still overshooting now, we need to backtrack again
5641
+ // this happens in certain situations when diffing times in different zones,
5642
+ // because this calculation ignores time zones
5643
+ if (cursor > later) {
5644
+ // keep the "overshot by 1" around as highWater
5645
+ highWater = cursor;
5646
+ // backtrack cursor by 1
5647
+ results[unit]--;
5648
+ cursor = earlier.plus(results);
5649
+ }
5205
5650
  } else {
5206
5651
  cursor = highWater;
5207
5652
  }
@@ -5380,6 +5825,11 @@ function simple(regex) {
5380
5825
  function escapeToken(value) {
5381
5826
  return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
5382
5827
  }
5828
+
5829
+ /**
5830
+ * @param token
5831
+ * @param {Locale} loc
5832
+ */
5383
5833
  function unitForToken(token, loc) {
5384
5834
  var one = digitRegex(loc),
5385
5835
  two = digitRegex(loc, "{2}"),
@@ -5409,9 +5859,9 @@ function unitForToken(token, loc) {
5409
5859
  switch (t.val) {
5410
5860
  // era
5411
5861
  case "G":
5412
- return oneOf(loc.eras("short", false), 0);
5862
+ return oneOf(loc.eras("short"), 0);
5413
5863
  case "GG":
5414
- return oneOf(loc.eras("long", false), 0);
5864
+ return oneOf(loc.eras("long"), 0);
5415
5865
  // years
5416
5866
  case "y":
5417
5867
  return intUnit(oneToSix);
@@ -5429,17 +5879,17 @@ function unitForToken(token, loc) {
5429
5879
  case "MM":
5430
5880
  return intUnit(two);
5431
5881
  case "MMM":
5432
- return oneOf(loc.months("short", true, false), 1);
5882
+ return oneOf(loc.months("short", true), 1);
5433
5883
  case "MMMM":
5434
- return oneOf(loc.months("long", true, false), 1);
5884
+ return oneOf(loc.months("long", true), 1);
5435
5885
  case "L":
5436
5886
  return intUnit(oneOrTwo);
5437
5887
  case "LL":
5438
5888
  return intUnit(two);
5439
5889
  case "LLL":
5440
- return oneOf(loc.months("short", false, false), 1);
5890
+ return oneOf(loc.months("short", false), 1);
5441
5891
  case "LLLL":
5442
- return oneOf(loc.months("long", false, false), 1);
5892
+ return oneOf(loc.months("long", false), 1);
5443
5893
  // dates
5444
5894
  case "d":
5445
5895
  return intUnit(oneOrTwo);
@@ -5499,13 +5949,13 @@ function unitForToken(token, loc) {
5499
5949
  case "c":
5500
5950
  return intUnit(one);
5501
5951
  case "EEE":
5502
- return oneOf(loc.weekdays("short", false, false), 1);
5952
+ return oneOf(loc.weekdays("short", false), 1);
5503
5953
  case "EEEE":
5504
- return oneOf(loc.weekdays("long", false, false), 1);
5954
+ return oneOf(loc.weekdays("long", false), 1);
5505
5955
  case "ccc":
5506
- return oneOf(loc.weekdays("short", true, false), 1);
5956
+ return oneOf(loc.weekdays("short", true), 1);
5507
5957
  case "cccc":
5508
- return oneOf(loc.weekdays("long", true, false), 1);
5958
+ return oneOf(loc.weekdays("long", true), 1);
5509
5959
  // offset/zone
5510
5960
  case "Z":
5511
5961
  case "ZZ":
@@ -5551,10 +6001,14 @@ var partTypeStyleToTokenVal = {
5551
6001
  },
5552
6002
  dayperiod: "a",
5553
6003
  dayPeriod: "a",
5554
- hour: {
6004
+ hour12: {
5555
6005
  numeric: "h",
5556
6006
  "2-digit": "hh"
5557
6007
  },
6008
+ hour24: {
6009
+ numeric: "H",
6010
+ "2-digit": "HH"
6011
+ },
5558
6012
  minute: {
5559
6013
  numeric: "m",
5560
6014
  "2-digit": "mm"
@@ -5568,7 +6022,7 @@ var partTypeStyleToTokenVal = {
5568
6022
  short: "ZZZ"
5569
6023
  }
5570
6024
  };
5571
- function tokenForPart(part, formatOpts) {
6025
+ function tokenForPart(part, formatOpts, resolvedOpts) {
5572
6026
  var type = part.type,
5573
6027
  value = part.value;
5574
6028
  if (type === "literal") {
@@ -5579,7 +6033,27 @@ function tokenForPart(part, formatOpts) {
5579
6033
  };
5580
6034
  }
5581
6035
  var style = formatOpts[type];
5582
- var val = partTypeStyleToTokenVal[type];
6036
+
6037
+ // The user might have explicitly specified hour12 or hourCycle
6038
+ // if so, respect their decision
6039
+ // if not, refer back to the resolvedOpts, which are based on the locale
6040
+ var actualType = type;
6041
+ if (type === "hour") {
6042
+ if (formatOpts.hour12 != null) {
6043
+ actualType = formatOpts.hour12 ? "hour12" : "hour24";
6044
+ } else if (formatOpts.hourCycle != null) {
6045
+ if (formatOpts.hourCycle === "h11" || formatOpts.hourCycle === "h12") {
6046
+ actualType = "hour12";
6047
+ } else {
6048
+ actualType = "hour24";
6049
+ }
6050
+ } else {
6051
+ // tokens only differentiate between 24 hours or not,
6052
+ // so we do not need to check hourCycle here, which is less supported anyways
6053
+ actualType = resolvedOpts.hour12 ? "hour12" : "hour24";
6054
+ }
6055
+ }
6056
+ var val = partTypeStyleToTokenVal[actualType];
5583
6057
  if (typeof val === "object") {
5584
6058
  val = val[style];
5585
6059
  }
@@ -5772,168 +6246,14 @@ function formatOptsToTokens(formatOpts, locale) {
5772
6246
  return null;
5773
6247
  }
5774
6248
  var formatter = Formatter.create(locale, formatOpts);
5775
- var parts = formatter.formatDateTimeParts(getDummyDateTime());
6249
+ var df = formatter.dtFormatter(getDummyDateTime());
6250
+ var parts = df.formatToParts();
6251
+ var resolvedOpts = df.resolvedOptions();
5776
6252
  return parts.map(function (p) {
5777
- return tokenForPart(p, formatOpts);
6253
+ return tokenForPart(p, formatOpts, resolvedOpts);
5778
6254
  });
5779
6255
  }
5780
6256
 
5781
- var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334],
5782
- leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
5783
- function unitOutOfRange(unit, value) {
5784
- return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid");
5785
- }
5786
- function dayOfWeek(year, month, day) {
5787
- var d = new Date(Date.UTC(year, month - 1, day));
5788
- if (year < 100 && year >= 0) {
5789
- d.setUTCFullYear(d.getUTCFullYear() - 1900);
5790
- }
5791
- var js = d.getUTCDay();
5792
- return js === 0 ? 7 : js;
5793
- }
5794
- function computeOrdinal(year, month, day) {
5795
- return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
5796
- }
5797
- function uncomputeOrdinal(year, ordinal) {
5798
- var table = isLeapYear(year) ? leapLadder : nonLeapLadder,
5799
- month0 = table.findIndex(function (i) {
5800
- return i < ordinal;
5801
- }),
5802
- day = ordinal - table[month0];
5803
- return {
5804
- month: month0 + 1,
5805
- day: day
5806
- };
5807
- }
5808
-
5809
- /**
5810
- * @private
5811
- */
5812
-
5813
- function gregorianToWeek(gregObj) {
5814
- var year = gregObj.year,
5815
- month = gregObj.month,
5816
- day = gregObj.day,
5817
- ordinal = computeOrdinal(year, month, day),
5818
- weekday = dayOfWeek(year, month, day);
5819
- var weekNumber = Math.floor((ordinal - weekday + 10) / 7),
5820
- weekYear;
5821
- if (weekNumber < 1) {
5822
- weekYear = year - 1;
5823
- weekNumber = weeksInWeekYear(weekYear);
5824
- } else if (weekNumber > weeksInWeekYear(year)) {
5825
- weekYear = year + 1;
5826
- weekNumber = 1;
5827
- } else {
5828
- weekYear = year;
5829
- }
5830
- return _extends({
5831
- weekYear: weekYear,
5832
- weekNumber: weekNumber,
5833
- weekday: weekday
5834
- }, timeObject(gregObj));
5835
- }
5836
- function weekToGregorian(weekData) {
5837
- var weekYear = weekData.weekYear,
5838
- weekNumber = weekData.weekNumber,
5839
- weekday = weekData.weekday,
5840
- weekdayOfJan4 = dayOfWeek(weekYear, 1, 4),
5841
- yearInDays = daysInYear(weekYear);
5842
- var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3,
5843
- year;
5844
- if (ordinal < 1) {
5845
- year = weekYear - 1;
5846
- ordinal += daysInYear(year);
5847
- } else if (ordinal > yearInDays) {
5848
- year = weekYear + 1;
5849
- ordinal -= daysInYear(weekYear);
5850
- } else {
5851
- year = weekYear;
5852
- }
5853
- var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal),
5854
- month = _uncomputeOrdinal.month,
5855
- day = _uncomputeOrdinal.day;
5856
- return _extends({
5857
- year: year,
5858
- month: month,
5859
- day: day
5860
- }, timeObject(weekData));
5861
- }
5862
- function gregorianToOrdinal(gregData) {
5863
- var year = gregData.year,
5864
- month = gregData.month,
5865
- day = gregData.day;
5866
- var ordinal = computeOrdinal(year, month, day);
5867
- return _extends({
5868
- year: year,
5869
- ordinal: ordinal
5870
- }, timeObject(gregData));
5871
- }
5872
- function ordinalToGregorian(ordinalData) {
5873
- var year = ordinalData.year,
5874
- ordinal = ordinalData.ordinal;
5875
- var _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal),
5876
- month = _uncomputeOrdinal2.month,
5877
- day = _uncomputeOrdinal2.day;
5878
- return _extends({
5879
- year: year,
5880
- month: month,
5881
- day: day
5882
- }, timeObject(ordinalData));
5883
- }
5884
- function hasInvalidWeekData(obj) {
5885
- var validYear = isInteger(obj.weekYear),
5886
- validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)),
5887
- validWeekday = integerBetween(obj.weekday, 1, 7);
5888
- if (!validYear) {
5889
- return unitOutOfRange("weekYear", obj.weekYear);
5890
- } else if (!validWeek) {
5891
- return unitOutOfRange("week", obj.week);
5892
- } else if (!validWeekday) {
5893
- return unitOutOfRange("weekday", obj.weekday);
5894
- } else return false;
5895
- }
5896
- function hasInvalidOrdinalData(obj) {
5897
- var validYear = isInteger(obj.year),
5898
- validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
5899
- if (!validYear) {
5900
- return unitOutOfRange("year", obj.year);
5901
- } else if (!validOrdinal) {
5902
- return unitOutOfRange("ordinal", obj.ordinal);
5903
- } else return false;
5904
- }
5905
- function hasInvalidGregorianData(obj) {
5906
- var validYear = isInteger(obj.year),
5907
- validMonth = integerBetween(obj.month, 1, 12),
5908
- validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
5909
- if (!validYear) {
5910
- return unitOutOfRange("year", obj.year);
5911
- } else if (!validMonth) {
5912
- return unitOutOfRange("month", obj.month);
5913
- } else if (!validDay) {
5914
- return unitOutOfRange("day", obj.day);
5915
- } else return false;
5916
- }
5917
- function hasInvalidTimeData(obj) {
5918
- var hour = obj.hour,
5919
- minute = obj.minute,
5920
- second = obj.second,
5921
- millisecond = obj.millisecond;
5922
- var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0,
5923
- validMinute = integerBetween(minute, 0, 59),
5924
- validSecond = integerBetween(second, 0, 59),
5925
- validMillisecond = integerBetween(millisecond, 0, 999);
5926
- if (!validHour) {
5927
- return unitOutOfRange("hour", hour);
5928
- } else if (!validMinute) {
5929
- return unitOutOfRange("minute", minute);
5930
- } else if (!validSecond) {
5931
- return unitOutOfRange("second", second);
5932
- } else if (!validMillisecond) {
5933
- return unitOutOfRange("millisecond", millisecond);
5934
- } else return false;
5935
- }
5936
-
5937
6257
  var INVALID = "Invalid DateTime";
5938
6258
  var MAX_DATE = 8.64e15;
5939
6259
  function unsupportedZone(zone) {
@@ -5941,6 +6261,9 @@ function unsupportedZone(zone) {
5941
6261
  }
5942
6262
 
5943
6263
  // we cache week data on the DT object and this intermediates the cache
6264
+ /**
6265
+ * @param {DateTime} dt
6266
+ */
5944
6267
  function possiblyCachedWeekData(dt) {
5945
6268
  if (dt.weekData === null) {
5946
6269
  dt.weekData = gregorianToWeek(dt.c);
@@ -5948,6 +6271,16 @@ function possiblyCachedWeekData(dt) {
5948
6271
  return dt.weekData;
5949
6272
  }
5950
6273
 
6274
+ /**
6275
+ * @param {DateTime} dt
6276
+ */
6277
+ function possiblyCachedLocalWeekData(dt) {
6278
+ if (dt.localWeekData === null) {
6279
+ dt.localWeekData = gregorianToWeek(dt.c, dt.loc.getMinDaysInFirstWeek(), dt.loc.getStartOfWeek());
6280
+ }
6281
+ return dt.localWeekData;
6282
+ }
6283
+
5951
6284
  // clone really means, "make a new object with these modifications". all "setters" really use this
5952
6285
  // to create a new object while only changing some of the properties
5953
6286
  function clone(inst, alts) {
@@ -6096,13 +6429,13 @@ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeO
6096
6429
  if (extended) {
6097
6430
  c += ":";
6098
6431
  c += padStart(o.c.minute);
6099
- if (o.c.second !== 0 || !suppressSeconds) {
6432
+ if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
6100
6433
  c += ":";
6101
6434
  }
6102
6435
  } else {
6103
6436
  c += padStart(o.c.minute);
6104
6437
  }
6105
- if (o.c.second !== 0 || !suppressSeconds) {
6438
+ if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
6106
6439
  c += padStart(o.c.second);
6107
6440
  if (o.c.millisecond !== 0 || !suppressMilliseconds) {
6108
6441
  c += ".";
@@ -6191,6 +6524,21 @@ function normalizeUnit(unit) {
6191
6524
  if (!normalized) throw new InvalidUnitError(unit);
6192
6525
  return normalized;
6193
6526
  }
6527
+ function normalizeUnitWithLocalWeeks(unit) {
6528
+ switch (unit.toLowerCase()) {
6529
+ case "localweekday":
6530
+ case "localweekdays":
6531
+ return "localWeekday";
6532
+ case "localweeknumber":
6533
+ case "localweeknumbers":
6534
+ return "localWeekNumber";
6535
+ case "localweekyear":
6536
+ case "localweekyears":
6537
+ return "localWeekYear";
6538
+ default:
6539
+ return normalizeUnit(unit);
6540
+ }
6541
+ }
6194
6542
 
6195
6543
  // this is a dumbed down version of fromObject() that runs about 60% faster
6196
6544
  // but doesn't do any validation, makes a bunch of assumptions about what units
@@ -6287,7 +6635,7 @@ function lastOpts(argList) {
6287
6635
  *
6288
6636
  * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation.
6289
6637
  */
6290
- var DateTime = /*#__PURE__*/function () {
6638
+ var DateTime = /*#__PURE__*/function (_Symbol$for) {
6291
6639
  /**
6292
6640
  * @access private
6293
6641
  */
@@ -6331,6 +6679,10 @@ var DateTime = /*#__PURE__*/function () {
6331
6679
  * @access private
6332
6680
  */
6333
6681
  this.weekData = null;
6682
+ /**
6683
+ * @access private
6684
+ */
6685
+ this.localWeekData = null;
6334
6686
  /**
6335
6687
  * @access private
6336
6688
  */
@@ -6537,13 +6889,16 @@ var DateTime = /*#__PURE__*/function () {
6537
6889
  * @param {number} obj.weekYear - an ISO week year
6538
6890
  * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year
6539
6891
  * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday
6892
+ * @param {number} obj.localWeekYear - a week year, according to the locale
6893
+ * @param {number} obj.localWeekNumber - a week number, between 1 and 52 or 53, depending on the year, according to the locale
6894
+ * @param {number} obj.localWeekday - a weekday, 1-7, where 1 is the first and 7 is the last day of the week, according to the locale
6540
6895
  * @param {number} obj.hour - hour of the day, 0-23
6541
6896
  * @param {number} obj.minute - minute of the hour, 0-59
6542
6897
  * @param {number} obj.second - second of the minute, 0-59
6543
6898
  * @param {number} obj.millisecond - millisecond of the second, 0-999
6544
6899
  * @param {Object} opts - options for creating this DateTime
6545
6900
  * @param {string|Zone} [opts.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone()
6546
- * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance
6901
+ * @param {string} [opts.locale='system\'s locale'] - a locale to set on the resulting DateTime instance
6547
6902
  * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance
6548
6903
  * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance
6549
6904
  * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25'
@@ -6553,6 +6908,7 @@ var DateTime = /*#__PURE__*/function () {
6553
6908
  * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'local' })
6554
6909
  * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }, { zone: 'America/New_York' })
6555
6910
  * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13'
6911
+ * @example DateTime.fromObject({ localWeekYear: 2022, localWeekNumber: 1, localWeekday: 1 }, { locale: "en-US" }).toISODate() //=> '2021-12-26'
6556
6912
  * @return {DateTime}
6557
6913
  */;
6558
6914
  DateTime.fromObject = function fromObject(obj, opts) {
@@ -6564,15 +6920,18 @@ var DateTime = /*#__PURE__*/function () {
6564
6920
  if (!zoneToUse.isValid) {
6565
6921
  return DateTime.invalid(unsupportedZone(zoneToUse));
6566
6922
  }
6923
+ var loc = Locale.fromObject(opts);
6924
+ var normalized = normalizeObject(obj, normalizeUnitWithLocalWeeks);
6925
+ var _usesLocalWeekValues = usesLocalWeekValues(normalized, loc),
6926
+ minDaysInFirstWeek = _usesLocalWeekValues.minDaysInFirstWeek,
6927
+ startOfWeek = _usesLocalWeekValues.startOfWeek;
6567
6928
  var tsNow = Settings.now(),
6568
6929
  offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow),
6569
- normalized = normalizeObject(obj, normalizeUnit),
6570
6930
  containsOrdinal = !isUndefined(normalized.ordinal),
6571
6931
  containsGregorYear = !isUndefined(normalized.year),
6572
6932
  containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
6573
6933
  containsGregor = containsGregorYear || containsGregorMD,
6574
- definiteWeekDef = normalized.weekYear || normalized.weekNumber,
6575
- loc = Locale.fromObject(opts);
6934
+ definiteWeekDef = normalized.weekYear || normalized.weekNumber;
6576
6935
 
6577
6936
  // cases:
6578
6937
  // just a weekday -> this week's instance of that weekday, no worries
@@ -6595,7 +6954,7 @@ var DateTime = /*#__PURE__*/function () {
6595
6954
  if (useWeekData) {
6596
6955
  units = orderedWeekUnits;
6597
6956
  defaultValues = defaultWeekUnitValues;
6598
- objNow = gregorianToWeek(objNow);
6957
+ objNow = gregorianToWeek(objNow, minDaysInFirstWeek, startOfWeek);
6599
6958
  } else if (containsOrdinal) {
6600
6959
  units = orderedOrdinalUnits;
6601
6960
  defaultValues = defaultOrdinalUnitValues;
@@ -6620,14 +6979,14 @@ var DateTime = /*#__PURE__*/function () {
6620
6979
  }
6621
6980
 
6622
6981
  // make sure the values we have are in range
6623
- var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
6982
+ var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized),
6624
6983
  invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
6625
6984
  if (invalid) {
6626
6985
  return DateTime.invalid(invalid);
6627
6986
  }
6628
6987
 
6629
6988
  // compute the actual time
6630
- var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
6989
+ var gregorian = useWeekData ? weekToGregorian(normalized, minDaysInFirstWeek, startOfWeek) : containsOrdinal ? ordinalToGregorian(normalized) : normalized,
6631
6990
  _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse),
6632
6991
  tsFinal = _objToTS2[0],
6633
6992
  offsetFinal = _objToTS2[1],
@@ -6804,7 +7163,7 @@ var DateTime = /*#__PURE__*/function () {
6804
7163
 
6805
7164
  /**
6806
7165
  * Create an invalid DateTime.
6807
- * @param {DateTime} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent
7166
+ * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent.
6808
7167
  * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information
6809
7168
  * @return {DateTime}
6810
7169
  */;
@@ -6887,6 +7246,47 @@ var DateTime = /*#__PURE__*/function () {
6887
7246
  * * The DateTime was created by an operation on another invalid date
6888
7247
  * @type {boolean}
6889
7248
  */;
7249
+ /**
7250
+ * Get those DateTimes which have the same local time as this DateTime, but a different offset from UTC
7251
+ * in this DateTime's zone. During DST changes local time can be ambiguous, for example
7252
+ * `2023-10-29T02:30:00` in `Europe/Berlin` can have offset `+01:00` or `+02:00`.
7253
+ * This method will return both possible DateTimes if this DateTime's local time is ambiguous.
7254
+ * @returns {DateTime[]}
7255
+ */
7256
+ _proto.getPossibleOffsets = function getPossibleOffsets() {
7257
+ if (!this.isValid || this.isOffsetFixed) {
7258
+ return [this];
7259
+ }
7260
+ var dayMs = 86400000;
7261
+ var minuteMs = 60000;
7262
+ var localTS = objToLocalTS(this.c);
7263
+ var oEarlier = this.zone.offset(localTS - dayMs);
7264
+ var oLater = this.zone.offset(localTS + dayMs);
7265
+ var o1 = this.zone.offset(localTS - oEarlier * minuteMs);
7266
+ var o2 = this.zone.offset(localTS - oLater * minuteMs);
7267
+ if (o1 === o2) {
7268
+ return [this];
7269
+ }
7270
+ var ts1 = localTS - o1 * minuteMs;
7271
+ var ts2 = localTS - o2 * minuteMs;
7272
+ var c1 = tsToObj(ts1, o1);
7273
+ var c2 = tsToObj(ts2, o2);
7274
+ if (c1.hour === c2.hour && c1.minute === c2.minute && c1.second === c2.second && c1.millisecond === c2.millisecond) {
7275
+ return [clone(this, {
7276
+ ts: ts1
7277
+ }), clone(this, {
7278
+ ts: ts2
7279
+ })];
7280
+ }
7281
+ return [this];
7282
+ }
7283
+
7284
+ /**
7285
+ * Returns true if this DateTime is in a leap year, false otherwise
7286
+ * @example DateTime.local(2016).isInLeapYear //=> true
7287
+ * @example DateTime.local(2013).isInLeapYear //=> false
7288
+ * @type {boolean}
7289
+ */;
6890
7290
  /**
6891
7291
  * Returns the resolved Intl options for this DateTime.
6892
7292
  * This is useful in understanding the behavior of formatting methods
@@ -7009,6 +7409,9 @@ var DateTime = /*#__PURE__*/function () {
7009
7409
  /**
7010
7410
  * "Set" the values of specified units. Returns a newly-constructed DateTime.
7011
7411
  * You can only set units with this method; for "setting" metadata, see {@link DateTime#reconfigure} and {@link DateTime#setZone}.
7412
+ *
7413
+ * This method also supports setting locale-based week units, i.e. `localWeekday`, `localWeekNumber` and `localWeekYear`.
7414
+ * They cannot be mixed with ISO-week units like `weekday`.
7012
7415
  * @param {Object} values - a mapping of units to numbers
7013
7416
  * @example dt.set({ year: 2017 })
7014
7417
  * @example dt.set({ hour: 8, minute: 30 })
@@ -7018,8 +7421,11 @@ var DateTime = /*#__PURE__*/function () {
7018
7421
  */;
7019
7422
  _proto.set = function set(values) {
7020
7423
  if (!this.isValid) return this;
7021
- var normalized = normalizeObject(values, normalizeUnit),
7022
- settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday),
7424
+ var normalized = normalizeObject(values, normalizeUnitWithLocalWeeks);
7425
+ var _usesLocalWeekValues2 = usesLocalWeekValues(normalized, this.loc),
7426
+ minDaysInFirstWeek = _usesLocalWeekValues2.minDaysInFirstWeek,
7427
+ startOfWeek = _usesLocalWeekValues2.startOfWeek;
7428
+ var settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday),
7023
7429
  containsOrdinal = !isUndefined(normalized.ordinal),
7024
7430
  containsGregorYear = !isUndefined(normalized.year),
7025
7431
  containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day),
@@ -7033,7 +7439,7 @@ var DateTime = /*#__PURE__*/function () {
7033
7439
  }
7034
7440
  var mixed;
7035
7441
  if (settingWeekStuff) {
7036
- mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c), normalized));
7442
+ mixed = weekToGregorian(_extends({}, gregorianToWeek(this.c, minDaysInFirstWeek, startOfWeek), normalized), minDaysInFirstWeek, startOfWeek);
7037
7443
  } else if (!isUndefined(normalized.ordinal)) {
7038
7444
  mixed = ordinalToGregorian(_extends({}, gregorianToOrdinal(this.c), normalized));
7039
7445
  } else {
@@ -7088,6 +7494,8 @@ var DateTime = /*#__PURE__*/function () {
7088
7494
  /**
7089
7495
  * "Set" this DateTime to the beginning of a unit of time.
7090
7496
  * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
7497
+ * @param {Object} opts - options
7498
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
7091
7499
  * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01'
7092
7500
  * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01'
7093
7501
  * @example DateTime.local(2014, 3, 3).startOf('week').toISODate(); //=> '2014-03-03', weeks always start on Mondays
@@ -7095,7 +7503,10 @@ var DateTime = /*#__PURE__*/function () {
7095
7503
  * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00'
7096
7504
  * @return {DateTime}
7097
7505
  */;
7098
- _proto.startOf = function startOf(unit) {
7506
+ _proto.startOf = function startOf(unit, _temp3) {
7507
+ var _ref4 = _temp3 === void 0 ? {} : _temp3,
7508
+ _ref4$useLocaleWeeks = _ref4.useLocaleWeeks,
7509
+ useLocaleWeeks = _ref4$useLocaleWeeks === void 0 ? false : _ref4$useLocaleWeeks;
7099
7510
  if (!this.isValid) return this;
7100
7511
  var o = {},
7101
7512
  normalizedUnit = Duration.normalizeUnit(unit);
@@ -7124,7 +7535,16 @@ var DateTime = /*#__PURE__*/function () {
7124
7535
  }
7125
7536
 
7126
7537
  if (normalizedUnit === "weeks") {
7127
- o.weekday = 1;
7538
+ if (useLocaleWeeks) {
7539
+ var startOfWeek = this.loc.getStartOfWeek();
7540
+ var weekday = this.weekday;
7541
+ if (weekday < startOfWeek) {
7542
+ o.weekNumber = this.weekNumber - 1;
7543
+ }
7544
+ o.weekday = startOfWeek;
7545
+ } else {
7546
+ o.weekday = 1;
7547
+ }
7128
7548
  }
7129
7549
  if (normalizedUnit === "quarters") {
7130
7550
  var q = Math.ceil(this.month / 3);
@@ -7136,6 +7556,8 @@ var DateTime = /*#__PURE__*/function () {
7136
7556
  /**
7137
7557
  * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time
7138
7558
  * @param {string} unit - The unit to go to the end of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'.
7559
+ * @param {Object} opts - options
7560
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week
7139
7561
  * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00'
7140
7562
  * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00'
7141
7563
  * @example DateTime.local(2014, 3, 3).endOf('week').toISO(); // => '2014-03-09T23:59:59.999-05:00', weeks start on Mondays
@@ -7143,9 +7565,9 @@ var DateTime = /*#__PURE__*/function () {
7143
7565
  * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00'
7144
7566
  * @return {DateTime}
7145
7567
  */;
7146
- _proto.endOf = function endOf(unit) {
7568
+ _proto.endOf = function endOf(unit, opts) {
7147
7569
  var _this$plus;
7148
- return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit).minus(1) : this;
7570
+ return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit, opts).minus(1) : this;
7149
7571
  }
7150
7572
 
7151
7573
  // OUTPUT
@@ -7232,18 +7654,18 @@ var DateTime = /*#__PURE__*/function () {
7232
7654
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
7233
7655
  * @return {string}
7234
7656
  */;
7235
- _proto.toISO = function toISO(_temp3) {
7236
- var _ref4 = _temp3 === void 0 ? {} : _temp3,
7237
- _ref4$format = _ref4.format,
7238
- format = _ref4$format === void 0 ? "extended" : _ref4$format,
7239
- _ref4$suppressSeconds = _ref4.suppressSeconds,
7240
- suppressSeconds = _ref4$suppressSeconds === void 0 ? false : _ref4$suppressSeconds,
7241
- _ref4$suppressMillise = _ref4.suppressMilliseconds,
7242
- suppressMilliseconds = _ref4$suppressMillise === void 0 ? false : _ref4$suppressMillise,
7243
- _ref4$includeOffset = _ref4.includeOffset,
7244
- includeOffset = _ref4$includeOffset === void 0 ? true : _ref4$includeOffset,
7245
- _ref4$extendedZone = _ref4.extendedZone,
7246
- extendedZone = _ref4$extendedZone === void 0 ? false : _ref4$extendedZone;
7657
+ _proto.toISO = function toISO(_temp4) {
7658
+ var _ref5 = _temp4 === void 0 ? {} : _temp4,
7659
+ _ref5$format = _ref5.format,
7660
+ format = _ref5$format === void 0 ? "extended" : _ref5$format,
7661
+ _ref5$suppressSeconds = _ref5.suppressSeconds,
7662
+ suppressSeconds = _ref5$suppressSeconds === void 0 ? false : _ref5$suppressSeconds,
7663
+ _ref5$suppressMillise = _ref5.suppressMilliseconds,
7664
+ suppressMilliseconds = _ref5$suppressMillise === void 0 ? false : _ref5$suppressMillise,
7665
+ _ref5$includeOffset = _ref5.includeOffset,
7666
+ includeOffset = _ref5$includeOffset === void 0 ? true : _ref5$includeOffset,
7667
+ _ref5$extendedZone = _ref5.extendedZone,
7668
+ extendedZone = _ref5$extendedZone === void 0 ? false : _ref5$extendedZone;
7247
7669
  if (!this.isValid) {
7248
7670
  return null;
7249
7671
  }
@@ -7262,10 +7684,10 @@ var DateTime = /*#__PURE__*/function () {
7262
7684
  * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
7263
7685
  * @return {string}
7264
7686
  */;
7265
- _proto.toISODate = function toISODate(_temp4) {
7266
- var _ref5 = _temp4 === void 0 ? {} : _temp4,
7267
- _ref5$format = _ref5.format,
7268
- format = _ref5$format === void 0 ? "extended" : _ref5$format;
7687
+ _proto.toISODate = function toISODate(_temp5) {
7688
+ var _ref6 = _temp5 === void 0 ? {} : _temp5,
7689
+ _ref6$format = _ref6.format,
7690
+ format = _ref6$format === void 0 ? "extended" : _ref6$format;
7269
7691
  if (!this.isValid) {
7270
7692
  return null;
7271
7693
  }
@@ -7296,20 +7718,20 @@ var DateTime = /*#__PURE__*/function () {
7296
7718
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
7297
7719
  * @return {string}
7298
7720
  */;
7299
- _proto.toISOTime = function toISOTime(_temp5) {
7300
- var _ref6 = _temp5 === void 0 ? {} : _temp5,
7301
- _ref6$suppressMillise = _ref6.suppressMilliseconds,
7302
- suppressMilliseconds = _ref6$suppressMillise === void 0 ? false : _ref6$suppressMillise,
7303
- _ref6$suppressSeconds = _ref6.suppressSeconds,
7304
- suppressSeconds = _ref6$suppressSeconds === void 0 ? false : _ref6$suppressSeconds,
7305
- _ref6$includeOffset = _ref6.includeOffset,
7306
- includeOffset = _ref6$includeOffset === void 0 ? true : _ref6$includeOffset,
7307
- _ref6$includePrefix = _ref6.includePrefix,
7308
- includePrefix = _ref6$includePrefix === void 0 ? false : _ref6$includePrefix,
7309
- _ref6$extendedZone = _ref6.extendedZone,
7310
- extendedZone = _ref6$extendedZone === void 0 ? false : _ref6$extendedZone,
7311
- _ref6$format = _ref6.format,
7312
- format = _ref6$format === void 0 ? "extended" : _ref6$format;
7721
+ _proto.toISOTime = function toISOTime(_temp6) {
7722
+ var _ref7 = _temp6 === void 0 ? {} : _temp6,
7723
+ _ref7$suppressMillise = _ref7.suppressMilliseconds,
7724
+ suppressMilliseconds = _ref7$suppressMillise === void 0 ? false : _ref7$suppressMillise,
7725
+ _ref7$suppressSeconds = _ref7.suppressSeconds,
7726
+ suppressSeconds = _ref7$suppressSeconds === void 0 ? false : _ref7$suppressSeconds,
7727
+ _ref7$includeOffset = _ref7.includeOffset,
7728
+ includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
7729
+ _ref7$includePrefix = _ref7.includePrefix,
7730
+ includePrefix = _ref7$includePrefix === void 0 ? false : _ref7$includePrefix,
7731
+ _ref7$extendedZone = _ref7.extendedZone,
7732
+ extendedZone = _ref7$extendedZone === void 0 ? false : _ref7$extendedZone,
7733
+ _ref7$format = _ref7.format,
7734
+ format = _ref7$format === void 0 ? "extended" : _ref7$format;
7313
7735
  if (!this.isValid) {
7314
7736
  return null;
7315
7737
  }
@@ -7363,14 +7785,14 @@ var DateTime = /*#__PURE__*/function () {
7363
7785
  * @example DateTime.now().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York'
7364
7786
  * @return {string}
7365
7787
  */;
7366
- _proto.toSQLTime = function toSQLTime(_temp6) {
7367
- var _ref7 = _temp6 === void 0 ? {} : _temp6,
7368
- _ref7$includeOffset = _ref7.includeOffset,
7369
- includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
7370
- _ref7$includeZone = _ref7.includeZone,
7371
- includeZone = _ref7$includeZone === void 0 ? false : _ref7$includeZone,
7372
- _ref7$includeOffsetSp = _ref7.includeOffsetSpace,
7373
- includeOffsetSpace = _ref7$includeOffsetSp === void 0 ? true : _ref7$includeOffsetSp;
7788
+ _proto.toSQLTime = function toSQLTime(_temp7) {
7789
+ var _ref8 = _temp7 === void 0 ? {} : _temp7,
7790
+ _ref8$includeOffset = _ref8.includeOffset,
7791
+ includeOffset = _ref8$includeOffset === void 0 ? true : _ref8$includeOffset,
7792
+ _ref8$includeZone = _ref8.includeZone,
7793
+ includeZone = _ref8$includeZone === void 0 ? false : _ref8$includeZone,
7794
+ _ref8$includeOffsetSp = _ref8.includeOffsetSpace,
7795
+ includeOffsetSpace = _ref8$includeOffsetSp === void 0 ? true : _ref8$includeOffsetSp;
7374
7796
  var fmt = "HH:mm:ss.SSS";
7375
7797
  if (includeZone || includeOffset) {
7376
7798
  if (includeOffsetSpace) {
@@ -7415,6 +7837,18 @@ var DateTime = /*#__PURE__*/function () {
7415
7837
  return this.isValid ? this.toISO() : INVALID;
7416
7838
  }
7417
7839
 
7840
+ /**
7841
+ * Returns a string representation of this DateTime appropriate for the REPL.
7842
+ * @return {string}
7843
+ */;
7844
+ _proto[_Symbol$for] = function () {
7845
+ if (this.isValid) {
7846
+ return "DateTime { ts: " + this.toISO() + ", zone: " + this.zone.name + ", locale: " + this.locale + " }";
7847
+ } else {
7848
+ return "DateTime { Invalid, reason: " + this.invalidReason + " }";
7849
+ }
7850
+ }
7851
+
7418
7852
  /**
7419
7853
  * Returns the epoch milliseconds of this DateTime. Alias of {@link DateTime#toMillis}
7420
7854
  * @return {number}
@@ -7564,16 +7998,18 @@ var DateTime = /*#__PURE__*/function () {
7564
7998
  * Note that time zones are **ignored** in this comparison, which compares the **local** calendar time. Use {@link DateTime#setZone} to convert one of the dates if needed.
7565
7999
  * @param {DateTime} otherDateTime - the other DateTime
7566
8000
  * @param {string} unit - the unit of time to check sameness on
8001
+ * @param {Object} opts - options
8002
+ * @param {boolean} [opts.useLocaleWeeks=false] - If true, use weeks based on the locale, i.e. use the locale-dependent start of the week; only the locale of this DateTime is used
7567
8003
  * @example DateTime.now().hasSame(otherDT, 'day'); //~> true if otherDT is in the same current calendar day
7568
8004
  * @return {boolean}
7569
8005
  */;
7570
- _proto.hasSame = function hasSame(otherDateTime, unit) {
8006
+ _proto.hasSame = function hasSame(otherDateTime, unit, opts) {
7571
8007
  if (!this.isValid) return false;
7572
8008
  var inputMs = otherDateTime.valueOf();
7573
8009
  var adjustedToZone = this.setZone(otherDateTime.zone, {
7574
8010
  keepLocalTime: true
7575
8011
  });
7576
- return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
8012
+ return adjustedToZone.startOf(unit, opts) <= inputMs && inputMs <= adjustedToZone.endOf(unit, opts);
7577
8013
  }
7578
8014
 
7579
8015
  /**
@@ -7934,6 +8370,51 @@ var DateTime = /*#__PURE__*/function () {
7934
8370
  return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
7935
8371
  }
7936
8372
 
8373
+ /**
8374
+ * Returns true if this date is on a weekend according to the locale, false otherwise
8375
+ * @returns {boolean}
8376
+ */
8377
+ }, {
8378
+ key: "isWeekend",
8379
+ get: function get() {
8380
+ return this.isValid && this.loc.getWeekendDays().includes(this.weekday);
8381
+ }
8382
+
8383
+ /**
8384
+ * Get the day of the week according to the locale.
8385
+ * 1 is the first day of the week and 7 is the last day of the week.
8386
+ * If the locale assigns Sunday as the first day of the week, then a date which is a Sunday will return 1,
8387
+ * @returns {number}
8388
+ */
8389
+ }, {
8390
+ key: "localWeekday",
8391
+ get: function get() {
8392
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekday : NaN;
8393
+ }
8394
+
8395
+ /**
8396
+ * Get the week number of the week year according to the locale. Different locales assign week numbers differently,
8397
+ * because the week can start on different days of the week (see localWeekday) and because a different number of days
8398
+ * is required for a week to count as the first week of a year.
8399
+ * @returns {number}
8400
+ */
8401
+ }, {
8402
+ key: "localWeekNumber",
8403
+ get: function get() {
8404
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekNumber : NaN;
8405
+ }
8406
+
8407
+ /**
8408
+ * Get the week year according to the locale. Different locales assign week numbers (and therefor week years)
8409
+ * differently, see localWeekNumber.
8410
+ * @returns {number}
8411
+ */
8412
+ }, {
8413
+ key: "localWeekYear",
8414
+ get: function get() {
8415
+ return this.isValid ? possiblyCachedLocalWeekData(this).weekYear : NaN;
8416
+ }
8417
+
7937
8418
  /**
7938
8419
  * Get the ordinal (meaning the day of the year)
7939
8420
  * @example DateTime.local(2017, 5, 25).ordinal //=> 145
@@ -8077,13 +8558,6 @@ var DateTime = /*#__PURE__*/function () {
8077
8558
  }).offset;
8078
8559
  }
8079
8560
  }
8080
-
8081
- /**
8082
- * Returns true if this DateTime is in a leap year, false otherwise
8083
- * @example DateTime.local(2016).isInLeapYear //=> true
8084
- * @example DateTime.local(2013).isInLeapYear //=> false
8085
- * @type {boolean}
8086
- */
8087
8561
  }, {
8088
8562
  key: "isInLeapYear",
8089
8563
  get: function get() {
@@ -8126,6 +8600,18 @@ var DateTime = /*#__PURE__*/function () {
8126
8600
  get: function get() {
8127
8601
  return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
8128
8602
  }
8603
+
8604
+ /**
8605
+ * Returns the number of weeks in this DateTime's local week year
8606
+ * @example DateTime.local(2020, 6, {locale: 'en-US'}).weeksInLocalWeekYear //=> 52
8607
+ * @example DateTime.local(2020, 6, {locale: 'de-DE'}).weeksInLocalWeekYear //=> 53
8608
+ * @type {number}
8609
+ */
8610
+ }, {
8611
+ key: "weeksInLocalWeekYear",
8612
+ get: function get() {
8613
+ return this.isValid ? weeksInWeekYear(this.localWeekYear, this.loc.getMinDaysInFirstWeek(), this.loc.getStartOfWeek()) : NaN;
8614
+ }
8129
8615
  }], [{
8130
8616
  key: "DATE_SHORT",
8131
8617
  get: function get() {
@@ -8343,7 +8829,7 @@ var DateTime = /*#__PURE__*/function () {
8343
8829
  }
8344
8830
  }]);
8345
8831
  return DateTime;
8346
- }();
8832
+ }(Symbol.for("nodejs.util.inspect.custom"));
8347
8833
  function friendlyDateTime(dateTimeish) {
8348
8834
  if (DateTime.isDateTime(dateTimeish)) {
8349
8835
  return dateTimeish;
@@ -8356,7 +8842,7 @@ function friendlyDateTime(dateTimeish) {
8356
8842
  }
8357
8843
  }
8358
8844
 
8359
- var VERSION = "3.3.0";
8845
+ var VERSION = "3.4.4";
8360
8846
 
8361
8847
  exports.DateTime = DateTime;
8362
8848
  exports.Duration = Duration;
@@ -13027,6 +13513,8 @@ const KupPlanner$1 = /*@__PURE__*/ proxyCustomElement(class KupPlanner extends H
13027
13513
  "refresh": [64],
13028
13514
  "setProps": [64],
13029
13515
  "addPhases": [64]
13516
+ }, undefined, {
13517
+ "data": ["dataChanged"]
13030
13518
  }]);
13031
13519
  _KupPlanner_kupManager = new WeakMap(), _KupPlanner_lastOnChangeReceived = new WeakMap(), _KupPlanner_rootPlanner = new WeakMap(), _KupPlanner_phases = new WeakMap(), _KupPlanner_storedSettings = new WeakMap(), _KupPlanner_instances = new WeakSet(), _KupPlanner_renderReactPlannerElement = function _KupPlanner_renderReactPlannerElement() {
13032
13520
  var _a;