chronos-date 1.2.1 → 1.3.1

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 (77) hide show
  1. package/dist/{convert-mMaI4YP0.mjs → convert-BY-uEIvg.mjs} +3 -3
  2. package/dist/{convert-DbgntRVW.cjs → convert-z8FAUOuh.cjs} +3 -3
  3. package/dist/{greet-D07t2_e6.mjs → greet-D89spydp.mjs} +1 -1
  4. package/dist/{greet-hjVsd2dt.cjs → greet-ok0_Wai_.cjs} +1 -1
  5. package/dist/guards.cjs +3 -3
  6. package/dist/guards.d.cts +1 -1
  7. package/dist/guards.d.mts +1 -1
  8. package/dist/guards.mjs +3 -3
  9. package/dist/{helpers-CQzi908i.cjs → helpers-D8yAKOsC.cjs} +3 -3
  10. package/dist/{helpers-DEf4sevD.mjs → helpers-eVQCueAC.mjs} +3 -3
  11. package/dist/index.cjs +22 -22
  12. package/dist/index.d.cts +1 -1
  13. package/dist/index.d.mts +1 -1
  14. package/dist/index.mjs +22 -22
  15. package/dist/{non-primitives-DBtomDty.mjs → non-primitives-B38XfU4A.mjs} +1 -1
  16. package/dist/{non-primitives-D9zxCwX8.cjs → non-primitives-Dj558axv.cjs} +1 -1
  17. package/dist/plugins/banglaPlugin.cjs +4 -4
  18. package/dist/plugins/banglaPlugin.d.cts +2 -2
  19. package/dist/plugins/banglaPlugin.d.mts +2 -2
  20. package/dist/plugins/banglaPlugin.mjs +4 -4
  21. package/dist/plugins/businessPlugin.cjs +2 -2
  22. package/dist/plugins/businessPlugin.d.cts +10 -10
  23. package/dist/plugins/businessPlugin.d.mts +10 -10
  24. package/dist/plugins/businessPlugin.mjs +2 -2
  25. package/dist/plugins/dateRangePlugin.cjs +2 -2
  26. package/dist/plugins/dateRangePlugin.d.cts +2 -2
  27. package/dist/plugins/dateRangePlugin.d.mts +2 -2
  28. package/dist/plugins/dateRangePlugin.mjs +2 -2
  29. package/dist/plugins/dayPartPlugin.cjs +1 -1
  30. package/dist/plugins/dayPartPlugin.d.cts +2 -2
  31. package/dist/plugins/dayPartPlugin.d.mts +2 -2
  32. package/dist/plugins/dayPartPlugin.mjs +1 -1
  33. package/dist/plugins/durationPlugin.d.cts +2 -2
  34. package/dist/plugins/durationPlugin.d.mts +2 -2
  35. package/dist/plugins/fromNowPlugin.cjs +1 -1
  36. package/dist/plugins/fromNowPlugin.d.cts +2 -2
  37. package/dist/plugins/fromNowPlugin.d.mts +2 -2
  38. package/dist/plugins/fromNowPlugin.mjs +1 -1
  39. package/dist/plugins/greetingPlugin.cjs +1 -1
  40. package/dist/plugins/greetingPlugin.d.cts +2 -2
  41. package/dist/plugins/greetingPlugin.d.mts +2 -2
  42. package/dist/plugins/greetingPlugin.mjs +1 -1
  43. package/dist/plugins/palindromePlugin.cjs +2 -2
  44. package/dist/plugins/palindromePlugin.d.cts +2 -2
  45. package/dist/plugins/palindromePlugin.d.mts +2 -2
  46. package/dist/plugins/palindromePlugin.mjs +2 -2
  47. package/dist/plugins/relativeTimePlugin.d.cts +2 -2
  48. package/dist/plugins/relativeTimePlugin.d.mts +2 -2
  49. package/dist/plugins/roundPlugin.cjs +1 -1
  50. package/dist/plugins/roundPlugin.d.cts +3 -3
  51. package/dist/plugins/roundPlugin.d.mts +3 -3
  52. package/dist/plugins/roundPlugin.mjs +1 -1
  53. package/dist/plugins/seasonPlugin.d.cts +2 -2
  54. package/dist/plugins/seasonPlugin.d.mts +2 -2
  55. package/dist/plugins/timeZonePlugin.cjs +6 -6
  56. package/dist/plugins/timeZonePlugin.d.cts +6 -6
  57. package/dist/plugins/timeZonePlugin.d.mts +6 -6
  58. package/dist/plugins/timeZonePlugin.mjs +6 -6
  59. package/dist/plugins/zodiacPlugin.cjs +1 -1
  60. package/dist/plugins/zodiacPlugin.d.cts +2 -2
  61. package/dist/plugins/zodiacPlugin.d.mts +2 -2
  62. package/dist/plugins/zodiacPlugin.mjs +1 -1
  63. package/dist/{primitives-dXzXlzJw.mjs → primitives-DpMa2dS2.mjs} +1 -1
  64. package/dist/{primitives-CtuSNmV7.cjs → primitives-DutXlR0D.cjs} +1 -1
  65. package/dist/{types-Bs_rfkka.d.mts → types-BwnEgU6z.d.mts} +74 -59
  66. package/dist/{types-CaVuY1_4.d.cts → types-CaZLuhLz.d.cts} +74 -59
  67. package/dist/types.d.cts +2 -2
  68. package/dist/types.d.mts +2 -2
  69. package/dist/{utilities-BKtVo78T.mjs → utilities-BfGFB7aw.mjs} +4 -4
  70. package/dist/{utilities-D47SN9EZ.cjs → utilities-CZTvwfjY.cjs} +4 -4
  71. package/dist/{utilities-BGX8dviZ.mjs → utilities-C_cYlUNI.mjs} +4 -4
  72. package/dist/{utilities-CpF3uys3.cjs → utilities-CkQA3Fkh.cjs} +4 -4
  73. package/dist/utils.cjs +4 -4
  74. package/dist/utils.d.cts +1 -1
  75. package/dist/utils.d.mts +1 -1
  76. package/dist/utils.mjs +4 -4
  77. package/package.json +4 -4
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { C as $Chronos, Lt as UTCOffset, Mt as TimeZoneIdentifier, Nt as TimeZoneName, Ot as TimeZone, Tn as LooseLiteral } from "../types-CaVuY1_4.cjs";
17
+ import { En as LooseLiteral, Nt as TimeZoneIdentifier, Pt as TimeZoneName, Rt as UTCOffset, kt as TimeZone, o as ChronosPlugin } from "../types-CaZLuhLz.cjs";
18
18
 
19
19
  //#region src/plugins/timeZonePlugin.d.ts
20
20
  declare module 'chronos-date' {
@@ -27,7 +27,7 @@ declare module 'chronos-date' {
27
27
  * @param tzId - Time zone identifier (e.g., `'Africa/Harare'`). See: {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database on Wikipedia}.
28
28
  * @returns A new instance of `Chronos` with time in the given time zone identifier. Invalid input sets time-zone to `UTC`.
29
29
  */
30
- timeZone(tzId: TimeZoneIdentifier): Chronos;
30
+ timeZone<Tz extends TimeZoneIdentifier>(tzId: Tz): Chronos<Tz>;
31
31
  /**
32
32
  * @instance Creates a new instance of `Chronos` for the specified abbreviated time zone name.
33
33
  *
@@ -36,7 +36,7 @@ declare module 'chronos-date' {
36
36
  * @param zone - Standard time zone abbreviation (e.g., `'IST'`, `'UTC'`, `'EST'` etc.). See: {@link https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations Time zone abbreviations on Wikipedia}.
37
37
  * @returns A new instance of `Chronos` with time in the given time zone abbreviation. Invalid input sets time-zone to `UTC`.
38
38
  */
39
- timeZone(zone: TimeZone): Chronos;
39
+ timeZone<Tz extends TimeZone>(zone: Tz): Chronos<Tz>;
40
40
  /**
41
41
  * @instance Creates a new instance of `Chronos` for the specified UTC offset.
42
42
  *
@@ -45,7 +45,7 @@ declare module 'chronos-date' {
45
45
  * @param utc - UTC Offset in `UTC±HH:mm` format for fictional or unlisted time zone (e.g., `'UTC+06:15'`).
46
46
  * @returns A new instance of `Chronos` with time in the given utc offset. Invalid input sets time-zone to `UTC`.
47
47
  */
48
- timeZone(utc: UTCOffset): Chronos;
48
+ timeZone<Tz extends UTCOffset>(utc: Tz): Chronos<Tz>;
49
49
  /**
50
50
  * @instance Creates a new instance of `Chronos` for the specified time zone id, abbreviation or UTC offset.
51
51
  *
@@ -57,7 +57,7 @@ declare module 'chronos-date' {
57
57
  * @param tz - A time zone identifier ({@link TimeZoneIdentifier}), time zone abbreviation ({@link TimeZone}), or UTC offset ({@link UTCOffset}).
58
58
  * @returns A new instance of `Chronos` with time in the given parameter. Invalid input sets time zone to `UTC`.
59
59
  */
60
- timeZone(tz: TimeZoneIdentifier | TimeZone | UTCOffset): Chronos;
60
+ timeZone<Tz extends TimeZoneIdentifier | TimeZone | UTCOffset>(tz: Tz): Chronos<Tz>;
61
61
  /**
62
62
  * @instance Returns the current time zone name as a full descriptive string (e.g. `"Bangladesh Standard Time"`).
63
63
  *
@@ -99,6 +99,6 @@ declare module 'chronos-date' {
99
99
  }
100
100
  }
101
101
  /** * Plugin to inject `timeZone` related methods */
102
- declare const timeZonePlugin: ($Chronos: $Chronos) => void;
102
+ declare const timeZonePlugin: ChronosPlugin;
103
103
  //#endregion
104
104
  export { timeZonePlugin };
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { C as $Chronos, Lt as UTCOffset, Mt as TimeZoneIdentifier, Nt as TimeZoneName, Ot as TimeZone, Tn as LooseLiteral } from "../types-Bs_rfkka.mjs";
17
+ import { En as LooseLiteral, Nt as TimeZoneIdentifier, Pt as TimeZoneName, Rt as UTCOffset, kt as TimeZone, o as ChronosPlugin } from "../types-BwnEgU6z.mjs";
18
18
 
19
19
  //#region src/plugins/timeZonePlugin.d.ts
20
20
  declare module 'chronos-date' {
@@ -27,7 +27,7 @@ declare module 'chronos-date' {
27
27
  * @param tzId - Time zone identifier (e.g., `'Africa/Harare'`). See: {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database on Wikipedia}.
28
28
  * @returns A new instance of `Chronos` with time in the given time zone identifier. Invalid input sets time-zone to `UTC`.
29
29
  */
30
- timeZone(tzId: TimeZoneIdentifier): Chronos;
30
+ timeZone<Tz extends TimeZoneIdentifier>(tzId: Tz): Chronos<Tz>;
31
31
  /**
32
32
  * @instance Creates a new instance of `Chronos` for the specified abbreviated time zone name.
33
33
  *
@@ -36,7 +36,7 @@ declare module 'chronos-date' {
36
36
  * @param zone - Standard time zone abbreviation (e.g., `'IST'`, `'UTC'`, `'EST'` etc.). See: {@link https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations Time zone abbreviations on Wikipedia}.
37
37
  * @returns A new instance of `Chronos` with time in the given time zone abbreviation. Invalid input sets time-zone to `UTC`.
38
38
  */
39
- timeZone(zone: TimeZone): Chronos;
39
+ timeZone<Tz extends TimeZone>(zone: Tz): Chronos<Tz>;
40
40
  /**
41
41
  * @instance Creates a new instance of `Chronos` for the specified UTC offset.
42
42
  *
@@ -45,7 +45,7 @@ declare module 'chronos-date' {
45
45
  * @param utc - UTC Offset in `UTC±HH:mm` format for fictional or unlisted time zone (e.g., `'UTC+06:15'`).
46
46
  * @returns A new instance of `Chronos` with time in the given utc offset. Invalid input sets time-zone to `UTC`.
47
47
  */
48
- timeZone(utc: UTCOffset): Chronos;
48
+ timeZone<Tz extends UTCOffset>(utc: Tz): Chronos<Tz>;
49
49
  /**
50
50
  * @instance Creates a new instance of `Chronos` for the specified time zone id, abbreviation or UTC offset.
51
51
  *
@@ -57,7 +57,7 @@ declare module 'chronos-date' {
57
57
  * @param tz - A time zone identifier ({@link TimeZoneIdentifier}), time zone abbreviation ({@link TimeZone}), or UTC offset ({@link UTCOffset}).
58
58
  * @returns A new instance of `Chronos` with time in the given parameter. Invalid input sets time zone to `UTC`.
59
59
  */
60
- timeZone(tz: TimeZoneIdentifier | TimeZone | UTCOffset): Chronos;
60
+ timeZone<Tz extends TimeZoneIdentifier | TimeZone | UTCOffset>(tz: Tz): Chronos<Tz>;
61
61
  /**
62
62
  * @instance Returns the current time zone name as a full descriptive string (e.g. `"Bangladesh Standard Time"`).
63
63
  *
@@ -99,6 +99,6 @@ declare module 'chronos-date' {
99
99
  }
100
100
  }
101
101
  /** * Plugin to inject `timeZone` related methods */
102
- declare const timeZonePlugin: ($Chronos: $Chronos) => void;
102
+ declare const timeZonePlugin: ChronosPlugin;
103
103
  //#endregion
104
104
  export { timeZonePlugin };
@@ -17,8 +17,8 @@
17
17
  import { s as INTERNALS } from "../basic-DqKyujoj.mjs";
18
18
  import { n as NATIVE_TZ_IDS, o as TIME_ZONE_LABELS, r as TIME_ZONES } from "../timezone-Db2CeL32.mjs";
19
19
  import { isValidUTCOffset } from "../guards.mjs";
20
- import { p as _resolveNativeTzName, s as _gmtToUtcOffset } from "../helpers-DEf4sevD.mjs";
21
- import { r as extractMinutesFromUTC } from "../utilities-BGX8dviZ.mjs";
20
+ import { p as _resolveNativeTzName, s as _gmtToUtcOffset } from "../helpers-eVQCueAC.mjs";
21
+ import { r as extractMinutesFromUTC } from "../utilities-C_cYlUNI.mjs";
22
22
 
23
23
  //#region src/plugins/timeZonePlugin.ts
24
24
  /** * Plugin to inject `timeZone` related methods */
@@ -64,7 +64,7 @@ const timeZonePlugin = ($Chronos) => {
64
64
  const TZ_ID_MAP = new Map(NATIVE_TZ_IDS.reduce((tzIds, id) => {
65
65
  const { offset } = _getTimeZoneDetails(id);
66
66
  if (offset) {
67
- const arr = tzIds.get(offset) ?? [];
67
+ const arr = tzIds.get(offset) || [];
68
68
  arr.push(id);
69
69
  tzIds.set(offset, arr);
70
70
  }
@@ -114,13 +114,13 @@ const timeZonePlugin = ($Chronos) => {
114
114
  tzId = zone;
115
115
  }
116
116
  const $zone = zone || offset;
117
- const tzName = _getTimeZoneName($zone, $Date(this)) ?? offset;
117
+ const tzName = _getTimeZoneName($zone, $Date(this)) || offset;
118
118
  const relativeOffset = extractMinutesFromUTC(offset) - this.getTimeZoneOffsetMinutes();
119
119
  return withOrigin(new $Chronos(new Date($Date(this).getTime() + relativeOffset * 60 * 1e3)), `timeZone`, offset, tzName, tzId, $zone);
120
120
  };
121
121
  $Chronos.prototype.getTimeZoneName = function(utc) {
122
122
  const UTC = utc || offset(this);
123
- return _getTimeZoneName(utc || this?.$tzTracker || offset(this), $Date(this)) ?? UTC;
123
+ return _getTimeZoneName(utc || this?.$tzTracker || offset(this), $Date(this)) || UTC;
124
124
  };
125
125
  /** Cache to store abbreviated time zone names */
126
126
  const TZ_ABBR_CACHE = /* @__PURE__ */ new Map();
@@ -144,7 +144,7 @@ const timeZonePlugin = ($Chronos) => {
144
144
  return tzAbbr;
145
145
  }
146
146
  }
147
- const zone = _getTimeZoneName(tzMapKey, $Date(this)) ?? UTC;
147
+ const zone = _getTimeZoneName(tzMapKey, $Date(this)) || UTC;
148
148
  const fallbackKey = `name-${zone}`;
149
149
  if (TZ_ABBR_CACHE.has(fallbackKey)) return TZ_ABBR_CACHE.get(fallbackKey);
150
150
  const customAbbr = isValidUTCOffset(zone) ? zone : _abbreviate(zone);
@@ -16,7 +16,7 @@
16
16
 
17
17
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
18
18
  const require_basic = require('../basic-DsQqC5nZ.cjs');
19
- const require_helpers = require('../helpers-CQzi908i.cjs');
19
+ const require_helpers = require('../helpers-D8yAKOsC.cjs');
20
20
 
21
21
  //#region src/plugins/zodiacPlugin.ts
22
22
  /** * Plugin to inject `zodiac` related methods */
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { C as $Chronos, S as ZodiacSign, b as ZodiacOptions, v as ZodiacMeta, y as ZodiacMetaOptions } from "../types-CaVuY1_4.cjs";
17
+ import { S as ZodiacSign, b as ZodiacOptions, o as ChronosPlugin, v as ZodiacMeta, y as ZodiacMetaOptions } from "../types-CaZLuhLz.cjs";
18
18
 
19
19
  //#region src/plugins/zodiacPlugin.d.ts
20
20
  declare module 'chronos-date' {
@@ -52,6 +52,6 @@ declare module 'chronos-date' {
52
52
  }
53
53
  }
54
54
  /** * Plugin to inject `zodiac` related methods */
55
- declare const zodiacPlugin: ($Chronos: $Chronos) => void;
55
+ declare const zodiacPlugin: ChronosPlugin;
56
56
  //#endregion
57
57
  export { zodiacPlugin };
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { C as $Chronos, S as ZodiacSign, b as ZodiacOptions, v as ZodiacMeta, y as ZodiacMetaOptions } from "../types-Bs_rfkka.mjs";
17
+ import { S as ZodiacSign, b as ZodiacOptions, o as ChronosPlugin, v as ZodiacMeta, y as ZodiacMetaOptions } from "../types-BwnEgU6z.mjs";
18
18
 
19
19
  //#region src/plugins/zodiacPlugin.d.ts
20
20
  declare module 'chronos-date' {
@@ -52,6 +52,6 @@ declare module 'chronos-date' {
52
52
  }
53
53
  }
54
54
  /** * Plugin to inject `zodiac` related methods */
55
- declare const zodiacPlugin: ($Chronos: $Chronos) => void;
55
+ declare const zodiacPlugin: ChronosPlugin;
56
56
  //#endregion
57
57
  export { zodiacPlugin };
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
  import { m as ZODIAC_PRESETS } from "../basic-DqKyujoj.mjs";
18
- import { f as _padZero } from "../helpers-DEf4sevD.mjs";
18
+ import { f as _padZero } from "../helpers-eVQCueAC.mjs";
19
19
 
20
20
  //#region src/plugins/zodiacPlugin.ts
21
21
  /** * Plugin to inject `zodiac` related methods */
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
17
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.10/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
18
18
  function isNumber(value) {
19
19
  return typeof value === "number" && Number.isFinite(value);
20
20
  }
@@ -15,7 +15,7 @@
15
15
  */
16
16
 
17
17
 
18
- //#region node_modules/.pnpm/nhb-toolbox@4.30.1/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
18
+ //#region node_modules/.pnpm/nhb-toolbox@4.30.10/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
19
19
  function isNumber(value) {
20
20
  return typeof value === "number" && Number.isFinite(value);
21
21
  }