@thisisagile/easy 18.11.1 → 18.11.2

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 (152) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-EGGEJRWA.mjs → chunk-2GYEWYBU.mjs} +4 -4
  3. package/dist/{chunk-UG3NG43J.mjs → chunk-44GORRHT.mjs} +3 -3
  4. package/dist/{chunk-WLTKHBFQ.mjs → chunk-4GK27OOO.mjs} +3 -3
  5. package/dist/{chunk-XVZYKKLD.mjs → chunk-66DVBO4C.mjs} +2 -2
  6. package/dist/{chunk-4FXDIYQT.mjs → chunk-6HTOXMLP.mjs} +3 -3
  7. package/dist/{chunk-PNSMLGOA.mjs → chunk-A7KUHZ3A.mjs} +2 -2
  8. package/dist/{chunk-I2VWZJ2K.mjs → chunk-AVHYDITZ.mjs} +4 -4
  9. package/dist/{chunk-4UKOKM72.mjs → chunk-CR2ZP2PA.mjs} +2 -2
  10. package/dist/{chunk-EFFUHXDK.mjs → chunk-DWSZUI3N.mjs} +4 -4
  11. package/dist/{chunk-ZO6LH5HU.mjs → chunk-FBZHPHXB.mjs} +2 -2
  12. package/dist/{chunk-YYXHD3PC.mjs → chunk-G6EOJ3XG.mjs} +2 -2
  13. package/dist/{chunk-3VDUMU5P.mjs → chunk-GYJHZJKL.mjs} +2 -2
  14. package/dist/chunk-HFRGTGH6.mjs +140 -0
  15. package/dist/chunk-HFRGTGH6.mjs.map +1 -0
  16. package/dist/{chunk-4NRVIWNE.mjs → chunk-HIM2UTGC.mjs} +2 -2
  17. package/dist/{chunk-RF23BV6J.mjs → chunk-IKUC55KC.mjs} +2 -2
  18. package/dist/{chunk-V5TW476J.mjs → chunk-IUZTBZYP.mjs} +2 -2
  19. package/dist/{chunk-M7OD5QSB.mjs → chunk-J6OJWNBP.mjs} +2 -2
  20. package/dist/{chunk-P4XVLBXB.mjs → chunk-JMAWKYXN.mjs} +2 -2
  21. package/dist/{chunk-M7MW5CXO.mjs → chunk-KGW3CVDO.mjs} +2 -2
  22. package/dist/{chunk-DODBPVV5.mjs → chunk-M2LLIIPG.mjs} +7 -7
  23. package/dist/{chunk-NQYUWVJT.mjs → chunk-MRV7FQNU.mjs} +2 -2
  24. package/dist/{chunk-J2RU23YZ.mjs → chunk-NUFTFLAY.mjs} +3 -3
  25. package/dist/{chunk-52VT3UEM.mjs → chunk-OWUSKHPI.mjs} +3 -3
  26. package/dist/{chunk-EHVMIXKR.mjs → chunk-PDPNMABX.mjs} +4 -4
  27. package/dist/{chunk-YDYQTX4H.mjs → chunk-QIBUS2GL.mjs} +3 -3
  28. package/dist/{chunk-HN3HW22I.mjs → chunk-RMQZRTTG.mjs} +2 -2
  29. package/dist/{chunk-KMEBQTNE.mjs → chunk-RPZ2XDQQ.mjs} +2 -2
  30. package/dist/{chunk-KXYGCS7S.mjs → chunk-TNJ2KFPQ.mjs} +2 -2
  31. package/dist/{chunk-BSN5WGZ6.mjs → chunk-TXXJY2Y7.mjs} +3 -3
  32. package/dist/{chunk-TNLJ45P5.mjs → chunk-ULOORN2E.mjs} +2 -2
  33. package/dist/{chunk-BODG3KPC.mjs → chunk-VENBCZAM.mjs} +3 -3
  34. package/dist/{chunk-YRVCY3KC.mjs → chunk-VOZBRY56.mjs} +4 -4
  35. package/dist/{chunk-4AEHKWWI.mjs → chunk-YTXIST3O.mjs} +2 -2
  36. package/dist/{chunk-HAGNDCSR.mjs → chunk-ZB323SGD.mjs} +2 -2
  37. package/dist/{chunk-5VP4WNID.mjs → chunk-ZPT6E6AF.mjs} +5 -5
  38. package/dist/data/Condition.mjs +4 -4
  39. package/dist/data/Database.mjs +3 -3
  40. package/dist/data/Field.mjs +4 -4
  41. package/dist/data/InMemoryGateway.mjs +4 -4
  42. package/dist/domain/Audit.mjs +8 -8
  43. package/dist/domain/Child.mjs +5 -5
  44. package/dist/domain/DateTime.d.ts +5 -7
  45. package/dist/domain/DateTime.mjs +4 -4
  46. package/dist/domain/Entity.mjs +8 -8
  47. package/dist/domain/Repo.mjs +4 -4
  48. package/dist/domain/Struct.mjs +4 -4
  49. package/dist/domain/Typo.mjs +4 -4
  50. package/dist/http/CacheControl.mjs +4 -4
  51. package/dist/http/ContentType.mjs +3 -3
  52. package/dist/http/HttpStatus.mjs +3 -3
  53. package/dist/http/HttpVerb.mjs +3 -3
  54. package/dist/http/LocalRequestStore.mjs +2 -2
  55. package/dist/http/RequestOptions.mjs +4 -4
  56. package/dist/http/RestResult.mjs +4 -4
  57. package/dist/http/toResponse.mjs +5 -5
  58. package/dist/index.js +33 -165
  59. package/dist/index.js.map +1 -1
  60. package/dist/process/App.mjs +3 -3
  61. package/dist/process/Manage.mjs +4 -4
  62. package/dist/process/Scope.mjs +3 -3
  63. package/dist/process/Search.mjs +4 -4
  64. package/dist/process/UseCase.mjs +2 -2
  65. package/dist/resources/Req.mjs +3 -3
  66. package/dist/services/Api.mjs +12 -12
  67. package/dist/services/ApiGateway.mjs +15 -15
  68. package/dist/services/AxiosProvider.mjs +10 -10
  69. package/dist/services/MappedRouteGateway.mjs +18 -18
  70. package/dist/services/RouteGateway.mjs +16 -16
  71. package/dist/services/ViewRouteGateway.mjs +18 -18
  72. package/dist/sql/Column.mjs +3 -3
  73. package/dist/sql/Count.mjs +5 -5
  74. package/dist/sql/Delete.mjs +4 -4
  75. package/dist/sql/Insert.mjs +4 -4
  76. package/dist/sql/Select.mjs +4 -4
  77. package/dist/sql/SqlQuery.mjs +3 -3
  78. package/dist/sql/Table.mjs +12 -12
  79. package/dist/sql/TableGateway.mjs +4 -4
  80. package/dist/sql/Update.mjs +4 -4
  81. package/dist/types/Cache.mjs +2 -2
  82. package/dist/types/CacheAge.mjs +4 -4
  83. package/dist/types/Case.mjs +2 -2
  84. package/dist/types/Context.mjs +2 -2
  85. package/dist/types/Enum.mjs +2 -2
  86. package/dist/types/Environment.mjs +2 -2
  87. package/dist/types/Exception.mjs +2 -2
  88. package/dist/types/Gateway.mjs +3 -3
  89. package/dist/types/IsEqual.mjs +2 -2
  90. package/dist/types/Json.mjs +3 -3
  91. package/dist/types/List.mjs +2 -2
  92. package/dist/types/Meta.mjs +2 -2
  93. package/dist/types/Number.mjs +3 -3
  94. package/dist/types/Object.mjs +2 -2
  95. package/dist/types/PageList.mjs +3 -3
  96. package/dist/types/Parser.mjs +2 -2
  97. package/dist/types/Repository.mjs +3 -3
  98. package/dist/types/Result.mjs +2 -2
  99. package/dist/types/Results.mjs +2 -2
  100. package/dist/types/Tag.mjs +2 -2
  101. package/dist/types/Template.mjs +2 -2
  102. package/dist/types/ToText.mjs +2 -2
  103. package/dist/types/Try.mjs +2 -2
  104. package/dist/types/Uri.mjs +2 -2
  105. package/dist/utils/If.mjs +2 -2
  106. package/dist/utils/Mapper.mjs +4 -4
  107. package/dist/utils/Period.mjs +4 -4
  108. package/dist/utils/Promise.mjs +2 -2
  109. package/dist/utils/Seconds.mjs +3 -3
  110. package/dist/utils/Sentence.mjs +2 -2
  111. package/dist/utils/View.mjs +5 -5
  112. package/dist/validation/Contraints.mjs +3 -3
  113. package/dist/validation/Validate.mjs +2 -2
  114. package/dist/validation/When.mjs +2 -2
  115. package/package.json +4 -9
  116. package/src/domain/DateTime.ts +40 -206
  117. package/dist/chunk-GRDUTNMZ.mjs +0 -272
  118. package/dist/chunk-GRDUTNMZ.mjs.map +0 -1
  119. /package/dist/{chunk-EGGEJRWA.mjs.map → chunk-2GYEWYBU.mjs.map} +0 -0
  120. /package/dist/{chunk-UG3NG43J.mjs.map → chunk-44GORRHT.mjs.map} +0 -0
  121. /package/dist/{chunk-WLTKHBFQ.mjs.map → chunk-4GK27OOO.mjs.map} +0 -0
  122. /package/dist/{chunk-XVZYKKLD.mjs.map → chunk-66DVBO4C.mjs.map} +0 -0
  123. /package/dist/{chunk-4FXDIYQT.mjs.map → chunk-6HTOXMLP.mjs.map} +0 -0
  124. /package/dist/{chunk-PNSMLGOA.mjs.map → chunk-A7KUHZ3A.mjs.map} +0 -0
  125. /package/dist/{chunk-I2VWZJ2K.mjs.map → chunk-AVHYDITZ.mjs.map} +0 -0
  126. /package/dist/{chunk-4UKOKM72.mjs.map → chunk-CR2ZP2PA.mjs.map} +0 -0
  127. /package/dist/{chunk-EFFUHXDK.mjs.map → chunk-DWSZUI3N.mjs.map} +0 -0
  128. /package/dist/{chunk-ZO6LH5HU.mjs.map → chunk-FBZHPHXB.mjs.map} +0 -0
  129. /package/dist/{chunk-YYXHD3PC.mjs.map → chunk-G6EOJ3XG.mjs.map} +0 -0
  130. /package/dist/{chunk-3VDUMU5P.mjs.map → chunk-GYJHZJKL.mjs.map} +0 -0
  131. /package/dist/{chunk-4NRVIWNE.mjs.map → chunk-HIM2UTGC.mjs.map} +0 -0
  132. /package/dist/{chunk-RF23BV6J.mjs.map → chunk-IKUC55KC.mjs.map} +0 -0
  133. /package/dist/{chunk-V5TW476J.mjs.map → chunk-IUZTBZYP.mjs.map} +0 -0
  134. /package/dist/{chunk-M7OD5QSB.mjs.map → chunk-J6OJWNBP.mjs.map} +0 -0
  135. /package/dist/{chunk-P4XVLBXB.mjs.map → chunk-JMAWKYXN.mjs.map} +0 -0
  136. /package/dist/{chunk-M7MW5CXO.mjs.map → chunk-KGW3CVDO.mjs.map} +0 -0
  137. /package/dist/{chunk-DODBPVV5.mjs.map → chunk-M2LLIIPG.mjs.map} +0 -0
  138. /package/dist/{chunk-NQYUWVJT.mjs.map → chunk-MRV7FQNU.mjs.map} +0 -0
  139. /package/dist/{chunk-J2RU23YZ.mjs.map → chunk-NUFTFLAY.mjs.map} +0 -0
  140. /package/dist/{chunk-52VT3UEM.mjs.map → chunk-OWUSKHPI.mjs.map} +0 -0
  141. /package/dist/{chunk-EHVMIXKR.mjs.map → chunk-PDPNMABX.mjs.map} +0 -0
  142. /package/dist/{chunk-YDYQTX4H.mjs.map → chunk-QIBUS2GL.mjs.map} +0 -0
  143. /package/dist/{chunk-HN3HW22I.mjs.map → chunk-RMQZRTTG.mjs.map} +0 -0
  144. /package/dist/{chunk-KMEBQTNE.mjs.map → chunk-RPZ2XDQQ.mjs.map} +0 -0
  145. /package/dist/{chunk-KXYGCS7S.mjs.map → chunk-TNJ2KFPQ.mjs.map} +0 -0
  146. /package/dist/{chunk-BSN5WGZ6.mjs.map → chunk-TXXJY2Y7.mjs.map} +0 -0
  147. /package/dist/{chunk-TNLJ45P5.mjs.map → chunk-ULOORN2E.mjs.map} +0 -0
  148. /package/dist/{chunk-BODG3KPC.mjs.map → chunk-VENBCZAM.mjs.map} +0 -0
  149. /package/dist/{chunk-YRVCY3KC.mjs.map → chunk-VOZBRY56.mjs.map} +0 -0
  150. /package/dist/{chunk-4AEHKWWI.mjs.map → chunk-YTXIST3O.mjs.map} +0 -0
  151. /package/dist/{chunk-HAGNDCSR.mjs.map → chunk-ZB323SGD.mjs.map} +0 -0
  152. /package/dist/{chunk-5VP4WNID.mjs.map → chunk-ZPT6E6AF.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -264,7 +264,7 @@ __export(src_exports, {
264
264
  template: () => template,
265
265
  text: () => text,
266
266
  textValue: () => textValue,
267
- timezone: () => timezone2,
267
+ timezone: () => timezone,
268
268
  timezones: () => timezones,
269
269
  toArray: () => toArray,
270
270
  toCacheOptions: () => toCacheOptions,
@@ -300,7 +300,7 @@ __export(src_exports, {
300
300
  tupleO: () => tupleO,
301
301
  uri: () => uri,
302
302
  use: () => use,
303
- utc: () => utc2,
303
+ utc: () => utc,
304
304
  valid: () => valid,
305
305
  validate: () => validate,
306
306
  validateReject: () => validateReject,
@@ -1796,17 +1796,7 @@ function isStruct(s) {
1796
1796
  }
1797
1797
 
1798
1798
  // src/domain/DateTime.ts
1799
- var import_dayjs = __toESM(require("dayjs"));
1800
- var import_advancedFormat = __toESM(require("dayjs/plugin/advancedFormat"));
1801
- var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
1802
- var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
1803
- var import_localizedFormat = __toESM(require("dayjs/plugin/localizedFormat"));
1804
- var import_quarterOfYear = __toESM(require("dayjs/plugin/quarterOfYear"));
1805
- var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime"));
1806
- var import_timezone = __toESM(require("dayjs/plugin/timezone"));
1807
- var import_utc = __toESM(require("dayjs/plugin/utc"));
1808
- var import_de = require("dayjs/locale/de");
1809
- var import_nl = require("dayjs/locale/nl");
1799
+ var import_luxon = require("luxon");
1810
1800
 
1811
1801
  // src/types/IsDate.ts
1812
1802
  var isDate = (o) => o instanceof Date && !isNaN(o.getTime());
@@ -1838,58 +1828,19 @@ var seconds = {
1838
1828
  };
1839
1829
 
1840
1830
  // src/domain/DateTime.ts
1841
- import_dayjs.default.extend(import_utc.default);
1842
- import_dayjs.default.extend(import_timezone.default);
1843
- import_dayjs.default.extend(import_customParseFormat.default);
1844
- import_dayjs.default.extend(import_localizedFormat.default);
1845
- import_dayjs.default.extend(import_relativeTime.default);
1846
- import_dayjs.default.extend(import_isoWeek.default);
1847
- import_dayjs.default.extend(import_advancedFormat.default);
1848
- import_dayjs.default.extend(import_quarterOfYear.default);
1849
- import_dayjs.default.tz.setDefault("UTC");
1850
- var invalidDate = import_dayjs.default.utc(Number.NaN);
1851
- var isDayjs = (value) => import_dayjs.default.isDayjs(value);
1852
- var isoFormats = [
1853
- "YYYY-MM-DD",
1854
- "YYYY-MM-DDTHH:mm",
1855
- "YYYY-MM-DDTHH:mm:ss",
1856
- "YYYY-MM-DDTHH:mm:ss.SSS",
1857
- "YYYY-MM-DDTHH:mm[Z]",
1858
- "YYYY-MM-DDTHH:mm:ss[Z]",
1859
- "YYYY-MM-DDTHH:mm:ss.SSS[Z]",
1860
- "YYYY-MM-DDTHH:mmZ",
1861
- "YYYY-MM-DDTHH:mmZZ",
1862
- "YYYY-MM-DDTHH:mm:ssZ",
1863
- "YYYY-MM-DDTHH:mm:ssZZ",
1864
- "YYYY-MM-DDTHH:mm:ss.SSSZ",
1865
- "YYYY-MM-DDTHH:mm:ss.SSSZZ"
1866
- ];
1867
- var fixedUnitMilliseconds = {
1868
- day: 864e5,
1869
- days: 864e5,
1870
- week: 6048e5,
1871
- weeks: 6048e5
1872
- };
1873
- var calendarUnitMonths = {
1874
- month: 1,
1875
- months: 1,
1876
- quarter: 3,
1877
- quarters: 3,
1878
- year: 12,
1879
- years: 12
1880
- };
1831
+ import_luxon.Settings.defaultZone = "utc";
1881
1832
  var DateTime = class _DateTime extends Value {
1882
- date;
1833
+ luxon;
1883
1834
  constructor(value, format) {
1884
- const date = choose(value).type(isDayjs, (date2) => date2).type(isDateTime, (dateTime) => dateTime.date).type(isNumber, (timestamp) => import_dayjs.default.utc(timestamp)).type(isDate, (date2) => import_dayjs.default.utc(date2)).type(isString, (string) => string === "" ? invalidDate : format ? parseFormatted(string, format) : parseIso(string)).else(invalidDate);
1885
- super(date.isValid() ? formatDateTime(date) : void 0);
1886
- this.date = date;
1835
+ const luxon = choose(value).type(isString, (v) => format ? import_luxon.DateTime.fromFormat(v, format, { setZone: true }) : import_luxon.DateTime.fromISO(v, { setZone: true })).type(isNumber, (v) => import_luxon.DateTime.fromMillis(v)).type(isDate, (v) => import_luxon.DateTime.fromJSDate(v)).type(isDateTime, (v) => v.luxon).else(value instanceof import_luxon.DateTime ? value : import_luxon.DateTime.fromISO(void 0));
1836
+ super(luxon.toISO() ?? void 0);
1837
+ this.luxon = luxon;
1887
1838
  }
1888
1839
  static get now() {
1889
- return fromDayjs(import_dayjs.default.utc(Date.now()));
1840
+ return new _DateTime(import_luxon.DateTime.utc());
1890
1841
  }
1891
1842
  get isValid() {
1892
- return isDefined(this.value) && this.date.isValid();
1843
+ return isDefined(this.value) && this.utc.isValid;
1893
1844
  }
1894
1845
  /**
1895
1846
  * @deprecated Deprecated in favor for DateTime.from as that also accepts locales and another DateTime
@@ -1910,161 +1861,78 @@ var DateTime = class _DateTime extends Value {
1910
1861
  return this.withZone("Europe/Warsaw");
1911
1862
  }
1912
1863
  get utc() {
1913
- return this.date.utc();
1864
+ return this.luxon.setZone("utc");
1914
1865
  }
1915
1866
  from(dateOrLocale, maybeLocale) {
1916
1867
  return use(
1917
1868
  (isString(dateOrLocale) ? dateOrLocale : maybeLocale) ?? "en",
1918
1869
  (locale) => ifDefined(
1919
1870
  isA(dateOrLocale) ? dateOrLocale : void 0,
1920
- (d) => this.utc.locale(toDayjsLocale(locale)).from(d.utc),
1921
- () => this.utc.locale(toDayjsLocale(locale)).from(import_dayjs.default.utc(Date.now()))
1871
+ (d) => this.utc.setLocale(locale).toRelative({ base: d.utc }),
1872
+ () => this.utc.setLocale(locale).toRelative()
1922
1873
  )
1923
1874
  ) ?? "";
1924
1875
  }
1925
1876
  isAfter(dt2) {
1926
- return this.utc.valueOf() > dt2.utc.valueOf();
1877
+ return this.utc > dt2.utc;
1927
1878
  }
1928
1879
  isBefore(dt2) {
1929
- return this.utc.valueOf() < dt2.utc.valueOf();
1880
+ return this.utc < dt2.utc;
1930
1881
  }
1931
1882
  equals(dt2) {
1932
- return this.utc.valueOf() === dt2.utc.valueOf();
1883
+ return this.utc.hasSame(dt2.utc, "millisecond");
1933
1884
  }
1934
1885
  add(n, unit = "day") {
1935
- return fromDayjs(change(this.date, n, unit, "add"));
1886
+ return new _DateTime(this.luxon.plus(isNumber(n) ? { [unit]: n } : n));
1936
1887
  }
1937
1888
  subtract(n, unit = "day") {
1938
- return fromDayjs(change(this.date, n, unit, "subtract"));
1889
+ return new _DateTime(this.luxon.minus(isNumber(n) ? { [unit]: n } : n));
1939
1890
  }
1940
1891
  diff(other, unit = "day", opts) {
1941
- return Math[opts?.rounding ?? "floor"](this.utc.diff(other.utc, toDayjsUnit(unit), true));
1892
+ return Math[opts?.rounding ?? "floor"](this.utc.diff(other.utc).as(unit));
1942
1893
  }
1943
1894
  startOf(unit = "day") {
1944
- return fromDayjs(this.date.startOf(toDayjsBoundaryUnit(unit)));
1895
+ return new _DateTime(this.luxon.startOf(unit));
1945
1896
  }
1946
1897
  endOf(unit = "day") {
1947
- return fromDayjs(this.date.endOf(toDayjsBoundaryUnit(unit)));
1898
+ return new _DateTime(this.luxon.endOf(unit));
1948
1899
  }
1949
1900
  isWeekend() {
1950
- const day = this.date.day();
1951
- return day === 0 || day === 6;
1901
+ return this.luxon.isWeekend;
1952
1902
  }
1953
1903
  withZone(zone) {
1954
- return fromDayjs(this.date.tz(zone));
1904
+ return new _DateTime(this.luxon.setZone(zone));
1955
1905
  }
1956
1906
  toString() {
1957
1907
  return this.value ?? "";
1958
1908
  }
1959
1909
  toJSON() {
1960
- return this.isValid ? this.utc.format("YYYY-MM-DDTHH:mm:ss.SSS[Z]") : null;
1910
+ return this.utc.toISO();
1961
1911
  }
1962
1912
  toFormat(format) {
1963
- return this.isValid ? this.date.format(toDayjsFormat(format)) : "";
1913
+ return this.luxon.toFormat(format);
1964
1914
  }
1965
1915
  toLocale(locale = "nl-NL", format = "D") {
1966
- if (!this.isValid)
1967
- return "";
1968
- if (format === "D")
1969
- return formatWithIntl(this.date, locale, { year: "numeric", month: "numeric", day: "numeric" });
1970
- if (format === "DDD")
1971
- return formatWithIntl(this.date, locale, { dateStyle: "long" });
1972
- if (format === "ffff") {
1973
- return formatWithIntl(this.date, locale, {
1974
- weekday: "long",
1975
- year: "numeric",
1976
- month: "long",
1977
- day: "numeric",
1978
- hour: "numeric",
1979
- minute: "2-digit",
1980
- timeZoneName: timezoneOf(this.date) ? "long" : "short"
1981
- });
1982
- }
1983
- return this.date.locale(toDayjsLocale(locale)).format(toDayjsFormat(format));
1916
+ return this.luxon.setLocale(locale).toFormat(format);
1984
1917
  }
1985
1918
  toFull(locale) {
1986
1919
  return this.toLocale(locale, "DDD");
1987
1920
  }
1988
1921
  toDate() {
1989
- return this.isValid ? this.utc.toDate() : void 0;
1922
+ return this.isValid ? this.utc.toJSDate() : void 0;
1990
1923
  }
1991
1924
  toEpoch() {
1992
- return this.date.valueOf();
1925
+ return this.luxon.toMillis();
1993
1926
  }
1994
1927
  ago(end = _DateTime.now) {
1995
1928
  return seconds.toText(end.diff(this, "second"));
1996
1929
  }
1997
1930
  withClock(clock) {
1998
- return tryTo(() => [this.toDate(), clock.toDate()]).map(([td, cd]) => new Date(Date.UTC(td.getUTCFullYear(), td.getUTCMonth(), td.getUTCDate(), cd.getUTCHours(), cd.getUTCMinutes(), cd.getUTCSeconds()))).map((d) => new _DateTime(d)).value;
1931
+ return tryTo(() => [this.toDate(), clock.toDate()]).map(([td, cd]) => new Date(td.getFullYear(), td.getMonth(), td.getDate(), cd.getHours(), cd.getMinutes(), cd.getSeconds())).map((d) => new _DateTime(d)).value;
1999
1932
  }
2000
1933
  };
2001
1934
  var isDateTime = (dt2) => isDefined(dt2) && dt2 instanceof DateTime;
2002
1935
  var dt = (dt2) => new DateTime(dt2);
2003
- var parseIso = (value) => {
2004
- const offset = offsetOf(value);
2005
- if (offset) {
2006
- const date = import_dayjs.default.utc(value);
2007
- return date.isValid() ? inOffsetZone(date, offset) : invalidDate;
2008
- }
2009
- return (0, import_dayjs.default)(value, isoFormats, true).isValid() ? import_dayjs.default.utc(value) : invalidDate;
2010
- };
2011
- var parseFormatted = (value, format) => {
2012
- const dayjsFormat = toDayjsFormat(format);
2013
- const offset = offsetOf(value);
2014
- if (format.includes("ZZZ") && offset) {
2015
- const iso = import_dayjs.default.utc(value);
2016
- return iso.isValid() ? inOffsetZone(iso, offset) : invalidDate;
2017
- }
2018
- return import_dayjs.default.utc(value, dayjsFormat, true);
2019
- };
2020
- var offsetOf = (value) => value.match(/([+-]\d{2}:?\d{2})$/)?.[1];
2021
- var fromDayjs = (date) => new DateTime(date);
2022
- var formatDateTime = (date) => {
2023
- const formatted = date.format("YYYY-MM-DDTHH:mm:ss.SSSZ");
2024
- return timezoneOf(date) ? formatted : formatted.replace("+00:00", "Z");
2025
- };
2026
- var change = (date, value, unit, direction) => {
2027
- if (isNumber(value))
2028
- return changeUnit(date, value, unit, direction);
2029
- return Object.entries(value).reduce((result, [durationUnit, durationValue]) => changeUnit(result, durationValue ?? 0, durationUnit, direction), date);
2030
- };
2031
- var changeUnit = (date, value, unit, direction) => {
2032
- const amount = direction === "add" ? value : -value;
2033
- const milliseconds = fixedUnitMilliseconds[unit];
2034
- const months = calendarUnitMonths[unit];
2035
- if (months && !Number.isInteger(value))
2036
- return addMonths(date, amount * months);
2037
- if (milliseconds && !Number.isInteger(value))
2038
- return date.add(amount * milliseconds, "millisecond");
2039
- return date.add(amount, toDayjsUnit(unit));
2040
- };
2041
- var addMonths = (date, months) => {
2042
- const wholeMonths = Math.trunc(months);
2043
- const fraction = months - wholeMonths;
2044
- const shifted = date.add(wholeMonths, "month");
2045
- if (fraction === 0)
2046
- return shifted;
2047
- const next = shifted.add(months > 0 ? 1 : -1, "month");
2048
- return shifted.add((next.valueOf() - shifted.valueOf()) * Math.abs(fraction), "millisecond");
2049
- };
2050
- var inOffsetZone = (date, offset) => offsetToTimeZone(offset).map((zone) => date.tz(zone)).or(date.utcOffset(offset));
2051
- var offsetToTimeZone = (offset) => tryTo(() => {
2052
- const [, sign, hours, minutes] = offset.match(/^([+-])(\d{2}):?(\d{2})$/) ?? [];
2053
- if (minutes !== "00")
2054
- throw new Error();
2055
- if (hours === "00")
2056
- return "UTC";
2057
- return `Etc/GMT${sign === "+" ? "-" : "+"}${Number(hours)}`;
2058
- });
2059
- var toDayjsUnit = (unit) => unit.replace(/s$/, "");
2060
- var toDayjsBoundaryUnit = (unit) => {
2061
- const dayjsUnit = toDayjsUnit(unit);
2062
- return dayjsUnit === "week" ? "isoWeek" : dayjsUnit;
2063
- };
2064
- var toDayjsFormat = (format) => format.replace(/'([^']+)'/g, "[$1]").replace(/EEE/g, "ddd").replace(/yyyy/g, "YYYY").replace(/dd/g, "DD").replace(/LLL/g, "MMM").replace(/ZZZ/g, "ZZ").replace(/hh/g, "HH");
2065
- var toDayjsLocale = (locale) => locale.toLowerCase().split("-")[0];
2066
- var formatWithIntl = (date, locale, options) => new Intl.DateTimeFormat(locale, { ...options, timeZone: timezoneOf(date) ?? "UTC" }).format(date.toDate());
2067
- var timezoneOf = (date) => date.$x?.$timezone;
2068
1936
 
2069
1937
  // src/validation/Contraints.ts
2070
1938
  var constraint = (c, message) => (subject, property) => {
@@ -3526,7 +3394,7 @@ var timezones = [
3526
3394
  "Europe/Warsaw",
3527
3395
  "America/New_York"
3528
3396
  ];
3529
- var timezone2 = {
3397
+ var timezone = {
3530
3398
  utc: "utc",
3531
3399
  amsterdam: "Europe/Amsterdam",
3532
3400
  berlin: "Europe/Berlin",
@@ -3537,8 +3405,8 @@ var timezone2 = {
3537
3405
  warsaw: "Europe/Warsaw",
3538
3406
  newYork: "America/New_York"
3539
3407
  };
3540
- var utc2 = timezone2.utc;
3541
- var ams = timezone2.amsterdam;
3408
+ var utc = timezone.utc;
3409
+ var ams = timezone.amsterdam;
3542
3410
 
3543
3411
  // src/types/Uri.ts
3544
3412
  var toSegment = (key, {
@@ -3655,7 +3523,7 @@ function dir(t) {
3655
3523
  }
3656
3524
 
3657
3525
  // src/utils/Period.ts
3658
- var toStartEnd = ({ period: period2, start, end, zone = utc2 }) => {
3526
+ var toStartEnd = ({ period: period2, start, end, zone = utc }) => {
3659
3527
  const today = DateTime.now.withZone(zone).startOf("day");
3660
3528
  return choose(period2).equals("today", { start: today, end: today.endOf("day") }).equals("yesterday", { start: today.subtract(1, "day"), end: today }).equals("tomorrow", { start: today.add(1, "day"), end: today.add(1, "day").endOf("day") }).equals("this-week", { start: today.startOf("week"), end: today.endOf("week") }).equals("last-seven-days", { start: today.subtract(6, "day"), end: today.endOf("day") }).equals("last-week", {
3661
3529
  start: today.subtract(1, "week").startOf("week"),