nhb-toolbox 4.26.41 → 4.26.45

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/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ All notable changes to the package will be documented here.
6
6
 
7
7
  ---
8
8
 
9
+ ## [4.26.45] - 2025-11-13
10
+
11
+ - **Removed** *time zone id* `'Factory'` from `TIME_ZONE_IDS` and **replaced** `'EDT'` with `'EST5EDT'` to fix the *issue with getting time zone details* using `Intl` API.
12
+
13
+ ## [4.26.44] - 2025-11-13
14
+
15
+ - **Fixed** issues with passing optional *time zone id* in `Chronos` method `$getNativeTimeZoneName` and `getTimeZoneDetails` utility.
16
+
9
17
  ## [4.26.41] - 2025-11-12
10
18
 
11
19
  - **Updated** *tsdoc* for some `Chronos` *methods* and `getTimeZoneDetails` utility.
@@ -129,7 +129,7 @@ class Chronos {
129
129
  }
130
130
  $getNativeTimeZoneName(tzId) {
131
131
  const $tzId = tzId || this.$getNativeTimeZoneId();
132
- return this.#getNativeTzName(tzId) ?? $tzId;
132
+ return this.#getNativeTzName($tzId) ?? $tzId;
133
133
  }
134
134
  $getNativeTimeZoneId() {
135
135
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -2461,9 +2461,9 @@ exports.TIME_ZONE_IDS = /* @__PURE__ */ Object.freeze({
2461
2461
  tzName: 'Eastern Standard Time',
2462
2462
  offset: 'UTC-05:00',
2463
2463
  },
2464
- EDT: {
2465
- tzName: 'Eastern Daylight Time',
2466
- offset: 'UTC-04:00',
2464
+ EST5EDT: {
2465
+ tzName: 'Eastern Standard Tim',
2466
+ offset: 'UTC-05:00',
2467
2467
  },
2468
2468
  'Etc/GMT': {
2469
2469
  tzName: 'Greenwich Mean Time',
@@ -2861,10 +2861,6 @@ exports.TIME_ZONE_IDS = /* @__PURE__ */ Object.freeze({
2861
2861
  tzName: 'Central European Time',
2862
2862
  offset: 'UTC+01:00',
2863
2863
  },
2864
- Factory: {
2865
- tzName: undefined,
2866
- offset: 'UTC+00:00',
2867
- },
2868
2864
  GB: {
2869
2865
  tzName: 'Greenwich Mean Time',
2870
2866
  offset: 'UTC+00:00',
@@ -41,10 +41,11 @@ function formatUTCOffset(minutes) {
41
41
  }
42
42
  function getTimeZoneDetails(tzId, date) {
43
43
  const TZ_NAME_TYPES = ['long', 'longGeneric', 'longOffset'];
44
- const obj = { tzIdentifier: tzId };
44
+ const $tzId = tzId || Intl.DateTimeFormat().resolvedOptions().timeZone;
45
+ const obj = { tzIdentifier: $tzId };
45
46
  for (const type of TZ_NAME_TYPES) {
46
47
  const parts = new Intl.DateTimeFormat('en', {
47
- timeZone: tzId,
48
+ timeZone: $tzId,
48
49
  timeZoneName: type,
49
50
  }).formatToParts(date);
50
51
  const tzPart = parts.find((p) => p.type === 'timeZoneName');
@@ -849,7 +849,7 @@ export declare const TIME_ZONES: Readonly<{
849
849
  readonly offset: "UTC+05:00";
850
850
  };
851
851
  }>;
852
- /** Record of unique standard time-zone labels/names for their corresponding UTC offsets as (`{ UTCOffset: timeZoneName }`). */
852
+ /** Record of unique standard time-zone labels/names for their corresponding UTC offsets as (`{ utcOffset: timeZoneName }`). */
853
853
  export declare const TIME_ZONE_LABELS: Readonly<{
854
854
  readonly 'UTC-12:00': "Baker Island Time";
855
855
  readonly 'UTC-11:00': "Samoa Standard Time";
@@ -895,7 +895,7 @@ export declare const TIME_ZONE_LABELS: Readonly<{
895
895
  readonly 'UTC+13:00': "Phoenix Island Time";
896
896
  readonly 'UTC+14:00': "Line Islands Time";
897
897
  }>;
898
- /** Record of timezone identifiers (from {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database on Wikipedia}) against their corresponding UTC offsets and full timezone names. */
898
+ /** Record of 597 timezone identifiers (from {@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones IANA TZ Database on Wikipedia}) against their corresponding UTC offsets and full timezone names. */
899
899
  export declare const TIME_ZONE_IDS: Readonly<{
900
900
  readonly 'Africa/Abidjan': {
901
901
  readonly tzName: "Greenwich Mean Time";
@@ -2461,9 +2461,9 @@ export declare const TIME_ZONE_IDS: Readonly<{
2461
2461
  readonly tzName: "Eastern Standard Time";
2462
2462
  readonly offset: "UTC-05:00";
2463
2463
  };
2464
- readonly EDT: {
2465
- readonly tzName: "Eastern Daylight Time";
2466
- readonly offset: "UTC-04:00";
2464
+ readonly EST5EDT: {
2465
+ readonly tzName: "Eastern Standard Tim";
2466
+ readonly offset: "UTC-05:00";
2467
2467
  };
2468
2468
  readonly 'Etc/GMT': {
2469
2469
  readonly tzName: "Greenwich Mean Time";
@@ -2861,10 +2861,6 @@ export declare const TIME_ZONE_IDS: Readonly<{
2861
2861
  readonly tzName: "Central European Time";
2862
2862
  readonly offset: "UTC+01:00";
2863
2863
  };
2864
- readonly Factory: {
2865
- readonly tzName: undefined;
2866
- readonly offset: "UTC+00:00";
2867
- };
2868
2864
  readonly GB: {
2869
2865
  readonly tzName: "Greenwich Mean Time";
2870
2866
  readonly offset: "UTC+00:00";
@@ -14,7 +14,7 @@ export type ClockMinute = `0${Enumerate<10>}` | `${NumberRange<10, 59>}`;
14
14
  export type ClockSecond = `0${Enumerate<10>}` | `${NumberRange<10, 59>}`;
15
15
  /** - Time in "HH:MM" format. */
16
16
  export type ClockTime = `${ClockHour}:${ClockMinute}`;
17
- /** Normal time in `H:m`m format which does not follow the strict limit up to 23 hours, hour can be any number and minute can be numeric string from `00` to `59` */
17
+ /** Normal time in `H:mm` format which does not follow the strict limit up to 23 hours, hour can be any number and minute can be numeric string from `00` to `59` */
18
18
  export type HourMinutes = `${number}:${ClockMinute}`;
19
19
  /** - Configuration options for greeting. */
20
20
  export interface GreetingConfigs {
@@ -47,20 +47,20 @@ export interface GreetingConfigs {
47
47
  /** Default greeting message if no period matches. */
48
48
  defaultMessage?: string;
49
49
  }
50
- /** Time zone details */
50
+ /** Time zone details object */
51
51
  export type TimeZoneDetails = {
52
- /** Time zone identifier */
52
+ /** IANA time zone identifier */
53
53
  tzIdentifier: LooseLiteral<TimeZoneIdentifier>;
54
- /** Full time zone name */
54
+ /** Long localized form (e.g., `'Pacific Standard Time'`, `'Nordamerikanische Westküsten-Normalzeit'`) */
55
55
  tzNameLong?: LooseLiteral<TimeZoneName>;
56
- /** Full time zone name but omits specific location */
56
+ /** Long generic non-location format (e.g.: `'Pacific Time'`, `'Nordamerikanische Westküstenzeit'`) */
57
57
  tzNameLongGeneric?: LooseLiteral<TimeZoneName>;
58
- /** Time zone offset from `UTC`, prefixed with `"GMT"` */
58
+ /** Long localized GMT format, prefixed with `"GMT"` (e.g., `"GMT-08:00"`) */
59
59
  tzNameLongOffset?: LooseLiteral<`GMT${$UTCOffset}`>;
60
60
  };
61
61
  /** Name of time unit from `year` to `millisecond` */
62
62
  export type TimeUnit = 'year' | 'month' | 'day' | 'week' | 'hour' | 'minute' | 'second' | 'millisecond';
63
- /** Name of time unit from `year` to `millisecond`, except `week` */
63
+ /** Name of time unit from `year` to `millisecond`, excluding `week` */
64
64
  export type FromNowUnit = Exclude<TimeUnit, 'week'>;
65
65
  /** Conditional value for {@link TimeUnit} */
66
66
  export type TimeUnitValue<Unit extends TimeUnit> = Unit extends 'month' ? NumberRange<1, 12> : Unit extends 'week' ? NumberRange<1, 53> : Unit extends 'day' ? NumberRange<1, 31> : Unit extends 'hour' ? Enumerate<24> : Unit extends 'minute' | 'second' ? Enumerate<60> : Unit extends 'millisecond' ? Milliseconds : number;
@@ -59,6 +59,6 @@ export declare function formatUTCOffset(minutes: Numeric): UTCOffset;
59
59
  * * Retrieves comprehensive time zone details using the {@link Intl} API.
60
60
  * @param tzId Optional timezone identifier; defaults to the system timezone.
61
61
  * @param date Optional date for which to resolve the information.
62
- * @returns Object containing identifier, names, and offset.
62
+ * @returns Object containing time zone identifier, names, and offset.
63
63
  */
64
64
  export declare function getTimeZoneDetails(tzId?: TimeZoneIdentifier, date?: Date): TimeZoneDetails;
@@ -126,7 +126,7 @@ export class Chronos {
126
126
  }
127
127
  $getNativeTimeZoneName(tzId) {
128
128
  const $tzId = tzId || this.$getNativeTimeZoneId();
129
- return this.#getNativeTzName(tzId) ?? $tzId;
129
+ return this.#getNativeTzName($tzId) ?? $tzId;
130
130
  }
131
131
  $getNativeTimeZoneId() {
132
132
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -2458,9 +2458,9 @@ export const TIME_ZONE_IDS = /* @__PURE__ */ Object.freeze({
2458
2458
  tzName: 'Eastern Standard Time',
2459
2459
  offset: 'UTC-05:00',
2460
2460
  },
2461
- EDT: {
2462
- tzName: 'Eastern Daylight Time',
2463
- offset: 'UTC-04:00',
2461
+ EST5EDT: {
2462
+ tzName: 'Eastern Standard Tim',
2463
+ offset: 'UTC-05:00',
2464
2464
  },
2465
2465
  'Etc/GMT': {
2466
2466
  tzName: 'Greenwich Mean Time',
@@ -2858,10 +2858,6 @@ export const TIME_ZONE_IDS = /* @__PURE__ */ Object.freeze({
2858
2858
  tzName: 'Central European Time',
2859
2859
  offset: 'UTC+01:00',
2860
2860
  },
2861
- Factory: {
2862
- tzName: undefined,
2863
- offset: 'UTC+00:00',
2864
- },
2865
2861
  GB: {
2866
2862
  tzName: 'Greenwich Mean Time',
2867
2863
  offset: 'UTC+00:00',
@@ -31,10 +31,11 @@ export function formatUTCOffset(minutes) {
31
31
  }
32
32
  export function getTimeZoneDetails(tzId, date) {
33
33
  const TZ_NAME_TYPES = ['long', 'longGeneric', 'longOffset'];
34
- const obj = { tzIdentifier: tzId };
34
+ const $tzId = tzId || Intl.DateTimeFormat().resolvedOptions().timeZone;
35
+ const obj = { tzIdentifier: $tzId };
35
36
  for (const type of TZ_NAME_TYPES) {
36
37
  const parts = new Intl.DateTimeFormat('en', {
37
- timeZone: tzId,
38
+ timeZone: $tzId,
38
39
  timeZoneName: type,
39
40
  }).formatToParts(date);
40
41
  const tzPart = parts.find((p) => p.type === 'timeZoneName');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhb-toolbox",
3
- "version": "4.26.41",
3
+ "version": "4.26.45",
4
4
  "description": "A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -44,7 +44,6 @@
44
44
  "@types/node": "^24.10.1",
45
45
  "@typescript-eslint/eslint-plugin": "^8.46.4",
46
46
  "@typescript-eslint/parser": "^8.46.4",
47
- "chalk": "^5.6.2",
48
47
  "eslint": "^9.39.1",
49
48
  "eslint-config-prettier": "^10.1.8",
50
49
  "eslint-plugin-prettier": "^5.5.4",