@trackunit/date-and-time-utils 1.11.67 → 1.11.69

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.
package/index.cjs.js CHANGED
@@ -49,11 +49,11 @@ const getHourCycle = (locale) => {
49
49
  if (intl.hourCycle) {
50
50
  return intl.hourCycle;
51
51
  }
52
- const hourCycles =
53
- // @ts-expect-error Some browser e.g. apparently the latest chrome have a cycle defined here, but not in intl.hourCycle
54
- intl.hourCycles || (typeof intl.getHourCycles === "function" && intl.getHourCycles());
55
- if (Array.isArray(hourCycles) && hourCycles[0]) {
56
- return hourCycles[0];
52
+ if ("getHourCycles" in intl && typeof intl.getHourCycles === "function") {
53
+ const hourCycles = intl.getHourCycles();
54
+ if (hourCycles[0]) {
55
+ return hourCycles[0];
56
+ }
57
57
  }
58
58
  if (LOCALES_WITH_23h_CYCLE.includes(locale)) {
59
59
  return "h23";
@@ -1628,6 +1628,10 @@ const parseValidDate = (date) => {
1628
1628
  return null;
1629
1629
  };
1630
1630
 
1631
+ Object.defineProperty(exports, "Temporal", {
1632
+ enumerable: true,
1633
+ get: function () { return polyfill.Temporal; }
1634
+ });
1631
1635
  exports.addDaysUtil = addDaysUtil;
1632
1636
  exports.addHoursUtil = addHoursUtil;
1633
1637
  exports.addMinutesUtil = addMinutesUtil;
package/index.esm.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import '@formatjs/intl-durationformat/polyfill';
2
2
  import { shouldPolyfill, supportedValuesOf } from '@formatjs/intl-enumerator';
3
3
  import { Temporal } from '@js-temporal/polyfill';
4
+ export { Temporal } from '@js-temporal/polyfill';
4
5
 
5
6
  /**
6
7
  * converts timZoneId to TimeZone object with default to current user timezone
@@ -47,11 +48,11 @@ const getHourCycle = (locale) => {
47
48
  if (intl.hourCycle) {
48
49
  return intl.hourCycle;
49
50
  }
50
- const hourCycles =
51
- // @ts-expect-error Some browser e.g. apparently the latest chrome have a cycle defined here, but not in intl.hourCycle
52
- intl.hourCycles || (typeof intl.getHourCycles === "function" && intl.getHourCycles());
53
- if (Array.isArray(hourCycles) && hourCycles[0]) {
54
- return hourCycles[0];
51
+ if ("getHourCycles" in intl && typeof intl.getHourCycles === "function") {
52
+ const hourCycles = intl.getHourCycles();
53
+ if (hourCycles[0]) {
54
+ return hourCycles[0];
55
+ }
55
56
  }
56
57
  if (LOCALES_WITH_23h_CYCLE.includes(locale)) {
57
58
  return "h23";
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@trackunit/date-and-time-utils",
3
- "version": "1.11.67",
3
+ "version": "1.11.69",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=24.x"
8
8
  },
9
9
  "dependencies": {
10
+ "@formatjs/intl-durationformat": "^0.6.1",
10
11
  "@formatjs/intl-enumerator": "^1.8.11",
11
- "@js-temporal/polyfill": "^0.5.1",
12
- "@formatjs/intl-durationformat": "^0.6.1"
12
+ "@js-temporal/polyfill": "^0.5.1"
13
13
  },
14
14
  "module": "./index.esm.js",
15
15
  "main": "./index.cjs.js",
@@ -1,5 +1,5 @@
1
1
  import "@formatjs/intl-durationformat/polyfill";
2
- import { Temporal } from "@js-temporal/polyfill";
2
+ import { Temporal } from "./temporal";
3
3
  export type TemporalTimeUnit = Temporal.TimeUnit;
4
4
  export type TemporalDate = Temporal.Instant | Temporal.ZonedDateTime | Date;
5
5
  type TemporalFormatTypes = Intl.DateTimeFormatOptions;
package/src/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./DateAndTimeUtils";
2
+ export { Temporal } from "./temporal";
@@ -0,0 +1 @@
1
+ export { Temporal } from "@js-temporal/polyfill";