nhb-toolbox 4.26.41 → 4.26.44
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,10 @@ All notable changes to the package will be documented here.
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [4.26.44] - 2025-11-13
|
|
10
|
+
|
|
11
|
+
- **Fixed** issues with passing optional *time zone id* in `Chronos` method `$getNativeTimeZoneName` and `getTimeZoneDetails` utility
|
|
12
|
+
|
|
9
13
|
## [4.26.41] - 2025-11-12
|
|
10
14
|
|
|
11
15
|
- **Updated** *tsdoc* for some `Chronos` *methods* and `getTimeZoneDetails` utility.
|
package/dist/cjs/date/Chronos.js
CHANGED
|
@@ -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;
|
package/dist/cjs/date/utils.js
CHANGED
|
@@ -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
|
|
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');
|
package/dist/dts/date/types.d.ts
CHANGED
|
@@ -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:
|
|
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
|
-
/**
|
|
52
|
+
/** IANA time zone identifier */
|
|
53
53
|
tzIdentifier: LooseLiteral<TimeZoneIdentifier>;
|
|
54
|
-
/**
|
|
54
|
+
/** Long localized form (e.g., `'Pacific Standard Time'`, `'Nordamerikanische Westküsten-Normalzeit'`) */
|
|
55
55
|
tzNameLong?: LooseLiteral<TimeZoneName>;
|
|
56
|
-
/**
|
|
56
|
+
/** Long generic non-location format (e.g.: `'Pacific Time'`, `'Nordamerikanische Westküstenzeit'`) */
|
|
57
57
|
tzNameLongGeneric?: LooseLiteral<TimeZoneName>;
|
|
58
|
-
/**
|
|
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`,
|
|
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;
|
package/dist/dts/date/utils.d.ts
CHANGED
|
@@ -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;
|
package/dist/esm/date/Chronos.js
CHANGED
|
@@ -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;
|
package/dist/esm/date/utils.js
CHANGED
|
@@ -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
|
|
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.
|
|
3
|
+
"version": "4.26.44",
|
|
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",
|