@interstellar-tools/temporal 0.60.4 → 0.61.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.
@@ -1,4 +1,4 @@
1
- import { TemporalInterface, TemporalUnitType } from '@interstellar-tools/types';
1
+ import type { TemporalInterface, TemporalUnitAliasType, TemporalUnitType } from '@interstellar-tools/types';
2
2
  /**
3
3
  * Seconds-per-unit lookup for all canonical {@link TemporalUnitType} symbols.
4
4
  *
@@ -8,6 +8,7 @@ import { TemporalInterface, TemporalUnitType } from '@interstellar-tools/types';
8
8
  * - **Julian year**: `yr = 365.25 d = 31 557 600 s`
9
9
  * (from {@link JULIAN_YEAR_SECONDS}); `kyr/Myr/Gyr` are powers of 10 thereof.
10
10
  * - Units are **canonical** and **case-sensitive** (e.g., `'μs'` uses the Unicode micro sign).
11
+ * - The table is frozen: it can be read, but not changed at runtime.
11
12
  *
12
13
  * $$
13
14
  * \text{seconds}(u) \;=\; \text{value}\times \mathrm{SECONDS\_PER}[u]
@@ -22,7 +23,7 @@ import { TemporalInterface, TemporalUnitType } from '@interstellar-tools/types';
22
23
  * SECONDS_PER.yr; // 31_557_600
23
24
  * ```
24
25
  */
25
- export declare const SECONDS_PER: Record<TemporalUnitType, number>;
26
+ export declare const SECONDS_PER: Readonly<Record<TemporalUnitType, number>>;
26
27
  /**
27
28
  * Convert a temporal **duration** between any two canonical {@link TemporalUnitType} units.
28
29
  *
@@ -30,7 +31,8 @@ export declare const SECONDS_PER: Record<TemporalUnitType, number>;
30
31
  * - Interprets `d` as the **SI day** and `yr/kyr/Myr/Gyr` via the **Julian year** convention.
31
32
  * - The `time.unit` is expected to be **canonical**; if you accept aliases upstream,
32
33
  * normalize them before calling (e.g., with `normalizeTemporalUnit`).
33
- * - The `targetUnit` is normalized to a canonical symbol (idempotent for canonical input).
34
+ * - The `targetUnit` may be a canonical unit or an alias such as `'days'`; it is
35
+ * normalized to a canonical symbol.
34
36
  *
35
37
  * $$
36
38
  * \text{value}_{\text{target}}
@@ -40,7 +42,7 @@ export declare const SECONDS_PER: Record<TemporalUnitType, number>;
40
42
  * $$
41
43
  *
42
44
  * @param time Input duration `{ value, unit }` in canonical units.
43
- * @param targetUnit Desired canonical output unit (will be normalized).
45
+ * @param targetUnit Desired output unit, canonical or an alias (will be normalized).
44
46
  * @returns A new `{ value, unit }` where `unit` is the canonical target symbol.
45
47
  *
46
48
  * @example
@@ -58,9 +60,10 @@ export declare const SECONDS_PER: Record<TemporalUnitType, number>;
58
60
  * // → { value: 365.25, unit: 'd' }
59
61
  * ```
60
62
  *
63
+ * @throws {RangeError} If `targetUnit` is not a known unit or alias.
61
64
  * @see SECONDS_PER_DAY
62
65
  * @see JULIAN_YEAR_SECONDS
63
66
  * @see normalizeTemporalUnit
64
67
  */
65
- export declare const convertTemporalUnit: (time: TemporalInterface, targetUnit: TemporalUnitType) => TemporalInterface;
68
+ export declare const convertTemporalUnit: (time: TemporalInterface, targetUnit: TemporalUnitType | TemporalUnitAliasType) => TemporalInterface;
66
69
  //# sourceMappingURL=convert-temporal-unit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert-temporal-unit.d.ts","sourceRoot":"","sources":["../src/convert-temporal-unit.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAIhF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAsBxD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,iBAAiB,EACvB,YAAY,gBAAgB,KAC3B,iBASF,CAAC"}
1
+ {"version":3,"file":"convert-temporal-unit.d.ts","sourceRoot":"","sources":["../src/convert-temporal-unit.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAInC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAuB/D,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,iBAAiB,EACvB,YAAY,gBAAgB,GAAG,qBAAqB,KACnD,iBASF,CAAC"}
@@ -9,6 +9,7 @@ import { normalizeTemporalUnit } from './normalize-temporal-unit.js';
9
9
  * - **Julian year**: `yr = 365.25 d = 31 557 600 s`
10
10
  * (from {@link JULIAN_YEAR_SECONDS}); `kyr/Myr/Gyr` are powers of 10 thereof.
11
11
  * - Units are **canonical** and **case-sensitive** (e.g., `'μs'` uses the Unicode micro sign).
12
+ * - The table is frozen: it can be read, but not changed at runtime.
12
13
  *
13
14
  * $$
14
15
  * \text{seconds}(u) \;=\; \text{value}\times \mathrm{SECONDS\_PER}[u]
@@ -23,7 +24,7 @@ import { normalizeTemporalUnit } from './normalize-temporal-unit.js';
23
24
  * SECONDS_PER.yr; // 31_557_600
24
25
  * ```
25
26
  */
26
- export const SECONDS_PER = {
27
+ export const SECONDS_PER = Object.freeze({
27
28
  // SI base & submultiples
28
29
  s: 1,
29
30
  ms: 1e-3,
@@ -43,7 +44,7 @@ export const SECONDS_PER = {
43
44
  kyr: JULIAN_YEAR_SECONDS * 1e3,
44
45
  Myr: JULIAN_YEAR_SECONDS * 1e6,
45
46
  Gyr: JULIAN_YEAR_SECONDS * 1e9
46
- };
47
+ });
47
48
  /**
48
49
  * Convert a temporal **duration** between any two canonical {@link TemporalUnitType} units.
49
50
  *
@@ -51,7 +52,8 @@ export const SECONDS_PER = {
51
52
  * - Interprets `d` as the **SI day** and `yr/kyr/Myr/Gyr` via the **Julian year** convention.
52
53
  * - The `time.unit` is expected to be **canonical**; if you accept aliases upstream,
53
54
  * normalize them before calling (e.g., with `normalizeTemporalUnit`).
54
- * - The `targetUnit` is normalized to a canonical symbol (idempotent for canonical input).
55
+ * - The `targetUnit` may be a canonical unit or an alias such as `'days'`; it is
56
+ * normalized to a canonical symbol.
55
57
  *
56
58
  * $$
57
59
  * \text{value}_{\text{target}}
@@ -61,7 +63,7 @@ export const SECONDS_PER = {
61
63
  * $$
62
64
  *
63
65
  * @param time Input duration `{ value, unit }` in canonical units.
64
- * @param targetUnit Desired canonical output unit (will be normalized).
66
+ * @param targetUnit Desired output unit, canonical or an alias (will be normalized).
65
67
  * @returns A new `{ value, unit }` where `unit` is the canonical target symbol.
66
68
  *
67
69
  * @example
@@ -79,6 +81,7 @@ export const SECONDS_PER = {
79
81
  * // → { value: 365.25, unit: 'd' }
80
82
  * ```
81
83
  *
84
+ * @throws {RangeError} If `targetUnit` is not a known unit or alias.
82
85
  * @see SECONDS_PER_DAY
83
86
  * @see JULIAN_YEAR_SECONDS
84
87
  * @see normalizeTemporalUnit
@@ -1 +1 @@
1
- {"version":3,"file":"convert-temporal-unit.js","sourceRoot":"","sources":["../src/convert-temporal-unit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,eAAe,EAChB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAqC;IAC3D,yBAAyB;IACzB,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IACT,EAAE,EAAE,KAAK;IAET,0BAA0B;IAC1B,GAAG,EAAE,EAAE;IACP,CAAC,EAAE,EAAE,GAAG,EAAE;IACV,CAAC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0B;IAC1B,GAAG,EAAE,EAAE;IACP,CAAC,EAAE,EAAE,GAAG,EAAE;IACV,CAAC,EAAE,eAAe;IAElB,kCAAkC;IAClC,EAAE,EAAE,mBAAmB;IACvB,GAAG,EAAE,mBAAmB,GAAG,GAAG;IAC9B,GAAG,EAAE,mBAAmB,GAAG,GAAG;IAC9B,GAAG,EAAE,mBAAmB,GAAG,GAAG;CAC/B,CAAC,CAAC;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,IAAuB,EACvB,UAAoD,EACjC,EAAE;IACrB,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC/D,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;IAC7B,2BAA2B;IAC3B,MAAM,SAAS,GAAG,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAC5C,4BAA4B;IAC5B,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAErE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;AAC/D,CAAC,CAAC"}
@@ -19,16 +19,12 @@ import type { TemporalUnitType } from '@interstellar-tools/types';
19
19
  * - Normalize with this map.
20
20
  * - Store/compute exclusively with canonical {@link TemporalUnitType}.
21
21
  *
22
- * ::: tip
23
- *
24
- * If you require runtime immutability, wrap with `Object.freeze(NORMALIZE_UNIT)`.
25
- *
26
- * :::
22
+ * The table is frozen: it can be read, but not changed at runtime.
27
23
  *
28
24
  * @see https://www.bipm.org/en/publications/si-brochure ([SI](https://en.wikipedia.org/wiki/International_System_of_Units) Brochure - second & day)
29
25
  * @see https://en.wikipedia.org/wiki/Julian_year_(astronomy) (Julian year for yr/kyr/Myr/Gyr)
30
26
  */
31
- export declare const NORMALIZE_UNIT: {
27
+ export declare const NORMALIZE_TEMPORAL_UNIT: Readonly<{
32
28
  readonly s: "s";
33
29
  readonly ms: "ms";
34
30
  readonly μs: "μs";
@@ -73,27 +69,27 @@ export declare const NORMALIZE_UNIT: {
73
69
  readonly gigaannum: "Gyr";
74
70
  readonly gigaannums: "Gyr";
75
71
  readonly Ga: "Gyr";
76
- };
72
+ }>;
77
73
  /**
78
74
  * Normalize a user-provided **temporal unit string** into a canonical {@link TemporalUnitType}.
79
75
  *
80
76
  * - Trims surrounding whitespace.
81
77
  * - Accepts both **canonical symbols** (e.g., `"s"`, `"ms"`, `"μs"`, `"min"`, `"h"`, `"d"`, `"yr"`, `"kyr"`, `"Myr"`, `"Gyr"`)
82
78
  * and **aliases** (e.g., `"seconds"`, `"milliseconds"`, `"us"`, `"hours"`, `"years"`, `"Ma"`, `"Ga"`),
83
- * using {@link NORMALIZE_UNIT} as the single source of truth.
79
+ * using {@link NORMALIZE_TEMPORAL_UNIT} as the single source of truth.
84
80
  * - Returns a **canonical** unit suitable for arithmetic, storage, and serialization.
85
81
  *
86
82
  * ### Conventions
87
83
  * - **Durations only** (no timestamp or "ago" semantics). Geology-style tokens like `"Ma"`/`"Ga"` are
88
84
  * interpreted as durations and normalized to `"Myr"`/`"Gyr"`.
89
- * - **Case-sensitive** exact match against {@link NORMALIZE_UNIT}. For example, `"Seconds"` (capital S)
85
+ * - **Case-sensitive** exact match against {@link NORMALIZE_TEMPORAL_UNIT}. For example, `"Seconds"` (capital S)
90
86
  * will fail; use `"seconds"` instead, or pre-normalize casing upstream if desired.
91
87
  * - The ASCII alias `"us"` is accepted and normalized to the Unicode microsecond symbol `"μs"`.
92
88
  *
93
89
  * @param u - The input unit string. Leading/trailing whitespace is ignored; content is **case-sensitive**.
94
90
  * @returns The canonical {@link TemporalUnitType} (e.g., `"s"`, `"ms"`, `"μs"`, `"min"`, `"h"`, `"d"`, `"yr"`, `"kyr"`, `"Myr"`, `"Gyr"`).
95
91
  *
96
- * @throws {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError | RangeError} If `u` does not match any known key in {@link NORMALIZE_UNIT}.
92
+ * @throws {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError | RangeError} If `u` does not match any known key in {@link NORMALIZE_TEMPORAL_UNIT}.
97
93
  *
98
94
  * @example
99
95
  * ```ts
@@ -108,7 +104,7 @@ export declare const NORMALIZE_UNIT: {
108
104
  * // normalizeTemporalUnit('Seconds'); // throws (case-sensitive)
109
105
  * ```
110
106
  *
111
- * @see {@link NORMALIZE_UNIT} for the complete alias→canonical mapping.
107
+ * @see {@link NORMALIZE_TEMPORAL_UNIT} for the complete alias→canonical mapping.
112
108
  * @see https://www.bipm.org/en/publications/si-brochure (SI Brochure - second/day)
113
109
  * @see https://en.wikipedia.org/wiki/Julian_year_(astronomy) (Julian year for yr/kyr/Myr/Gyr)
114
110
  */
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-temporal-unit.d.ts","sourceRoot":"","sources":["../src/normalize-temporal-unit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAGnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoD1B,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,eAAO,MAAM,qBAAqB,GAAI,GAAG,MAAM,KAAG,gBAOjD,CAAC"}
1
+ {"version":3,"file":"normalize-temporal-unit.d.ts","sourceRoot":"","sources":["../src/normalize-temporal-unit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAGnC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDlC,CAAC;AAGH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,eAAO,MAAM,qBAAqB,GAAI,GAAG,MAAM,KAAG,gBASjD,CAAC"}
@@ -19,17 +19,13 @@
19
19
  * - Normalize with this map.
20
20
  * - Store/compute exclusively with canonical {@link TemporalUnitType}.
21
21
  *
22
- * ::: tip
23
- *
24
- * If you require runtime immutability, wrap with `Object.freeze(NORMALIZE_UNIT)`.
25
- *
26
- * :::
22
+ * The table is frozen: it can be read, but not changed at runtime.
27
23
  *
28
24
  * @see https://www.bipm.org/en/publications/si-brochure ([SI](https://en.wikipedia.org/wiki/International_System_of_Units) Brochure - second & day)
29
25
  * @see https://en.wikipedia.org/wiki/Julian_year_(astronomy) (Julian year for yr/kyr/Myr/Gyr)
30
26
  */
31
27
  /* node:coverage enable */
32
- export const NORMALIZE_UNIT = {
28
+ export const NORMALIZE_TEMPORAL_UNIT = Object.freeze({
33
29
  // canonical already map to themselves:
34
30
  s: 's',
35
31
  ms: 'ms',
@@ -76,7 +72,7 @@ export const NORMALIZE_UNIT = {
76
72
  gigaannum: 'Gyr',
77
73
  gigaannums: 'Gyr',
78
74
  Ga: 'Gyr'
79
- };
75
+ });
80
76
  /* node:coverage disable */
81
77
  /**
82
78
  * Normalize a user-provided **temporal unit string** into a canonical {@link TemporalUnitType}.
@@ -84,20 +80,20 @@ export const NORMALIZE_UNIT = {
84
80
  * - Trims surrounding whitespace.
85
81
  * - Accepts both **canonical symbols** (e.g., `"s"`, `"ms"`, `"μs"`, `"min"`, `"h"`, `"d"`, `"yr"`, `"kyr"`, `"Myr"`, `"Gyr"`)
86
82
  * and **aliases** (e.g., `"seconds"`, `"milliseconds"`, `"us"`, `"hours"`, `"years"`, `"Ma"`, `"Ga"`),
87
- * using {@link NORMALIZE_UNIT} as the single source of truth.
83
+ * using {@link NORMALIZE_TEMPORAL_UNIT} as the single source of truth.
88
84
  * - Returns a **canonical** unit suitable for arithmetic, storage, and serialization.
89
85
  *
90
86
  * ### Conventions
91
87
  * - **Durations only** (no timestamp or "ago" semantics). Geology-style tokens like `"Ma"`/`"Ga"` are
92
88
  * interpreted as durations and normalized to `"Myr"`/`"Gyr"`.
93
- * - **Case-sensitive** exact match against {@link NORMALIZE_UNIT}. For example, `"Seconds"` (capital S)
89
+ * - **Case-sensitive** exact match against {@link NORMALIZE_TEMPORAL_UNIT}. For example, `"Seconds"` (capital S)
94
90
  * will fail; use `"seconds"` instead, or pre-normalize casing upstream if desired.
95
91
  * - The ASCII alias `"us"` is accepted and normalized to the Unicode microsecond symbol `"μs"`.
96
92
  *
97
93
  * @param u - The input unit string. Leading/trailing whitespace is ignored; content is **case-sensitive**.
98
94
  * @returns The canonical {@link TemporalUnitType} (e.g., `"s"`, `"ms"`, `"μs"`, `"min"`, `"h"`, `"d"`, `"yr"`, `"kyr"`, `"Myr"`, `"Gyr"`).
99
95
  *
100
- * @throws {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError | RangeError} If `u` does not match any known key in {@link NORMALIZE_UNIT}.
96
+ * @throws {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError | RangeError} If `u` does not match any known key in {@link NORMALIZE_TEMPORAL_UNIT}.
101
97
  *
102
98
  * @example
103
99
  * ```ts
@@ -112,16 +108,18 @@ export const NORMALIZE_UNIT = {
112
108
  * // normalizeTemporalUnit('Seconds'); // throws (case-sensitive)
113
109
  * ```
114
110
  *
115
- * @see {@link NORMALIZE_UNIT} for the complete alias→canonical mapping.
111
+ * @see {@link NORMALIZE_TEMPORAL_UNIT} for the complete alias→canonical mapping.
116
112
  * @see https://www.bipm.org/en/publications/si-brochure (SI Brochure - second/day)
117
113
  * @see https://en.wikipedia.org/wiki/Julian_year_(astronomy) (Julian year for yr/kyr/Myr/Gyr)
118
114
  */
119
115
  /* node:coverage enable */
120
116
  export const normalizeTemporalUnit = (u) => {
121
117
  const k = u.trim();
122
- const v = NORMALIZE_UNIT[k];
118
+ const v = Object.prototype.hasOwnProperty.call(NORMALIZE_TEMPORAL_UNIT, k)
119
+ ? NORMALIZE_TEMPORAL_UNIT[k]
120
+ : undefined;
123
121
  if (!v)
124
- throw new Error(`Unsupported unit: ${u}`);
122
+ throw new RangeError(`Unsupported unit: ${u}`);
125
123
  return v;
126
124
  };
127
125
  //# sourceMappingURL=normalize-temporal-unit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-temporal-unit.js","sourceRoot":"","sources":["../src/normalize-temporal-unit.ts"],"names":[],"mappings":"AAKA,2BAA2B;AAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,uCAAuC;IACvC,CAAC,EAAE,GAAG;IACN,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,CAAC,EAAE,GAAG;IACN,CAAC,EAAE,GAAG;IACN,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IAEV,sBAAsB;IACtB,MAAM,EAAE,GAAG;IACX,OAAO,EAAE,GAAG;IACZ,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,EAAE,EAAE,IAAI;IACR,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,GAAG;IACT,KAAK,EAAE,GAAG;IACV,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,IAAI;IACX,GAA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D,OAAO,CAAC,CAAC;AACX,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interstellar-tools/temporal",
3
- "version": "0.60.4",
3
+ "version": "0.61.0",
4
4
  "description": "Time and epoch utilities for space applications (e.g., building blocks toward Julian dates, conversions, and ephemeris-friendly time handling).",
5
5
  "keywords": [
6
6
  "temporal",