nhb-toolbox 4.13.9 → 4.13.10
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 +6 -0
- package/README.md +32 -5
- package/dist/cjs/date/Chronos.js +4 -2
- package/dist/cjs/date/constants.js +1 -1
- package/dist/cjs/date/plugins/timeZonePlugin.js +3 -3
- package/dist/cjs/pluralize/Pluralizer.js +5 -1
- package/dist/dts/date/Chronos.d.ts +5 -3
- package/dist/dts/date/Chronos.d.ts.map +1 -1
- package/dist/dts/date/constants.d.ts +1 -1
- package/dist/dts/date/plugins/timeZonePlugin.d.ts +4 -2
- package/dist/dts/date/plugins/timeZonePlugin.d.ts.map +1 -1
- package/dist/dts/pluralize/Pluralizer.d.ts +5 -1
- package/dist/dts/pluralize/Pluralizer.d.ts.map +1 -1
- package/dist/esm/date/Chronos.js +4 -2
- package/dist/esm/date/constants.js +1 -1
- package/dist/esm/date/plugins/timeZonePlugin.js +3 -3
- package/dist/esm/pluralize/Pluralizer.js +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ All notable changes to the package will be documented here.
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [4.13.10] - 2025-08-02
|
|
10
|
+
|
|
11
|
+
- **Updated** docs for `isPlural` and `isSingular` methods in `Pluralizer`.
|
|
12
|
+
- **Updated** `getTimeZoneName()` and `getTimeZoneNameShort()` methods in `Chronos` to accept an optional UTC offset.
|
|
13
|
+
- **Changed** return type of `getTimeZoneName()` to `string | UTCOffset` using `LooseLiteral<UTCOffset>`.
|
|
14
|
+
|
|
9
15
|
## [4.13.9] - 2025-07-31
|
|
10
16
|
|
|
11
17
|
- **Added** new `Chronos` method `getTimeZoneName()` to get full time-zone name.
|
package/README.md
CHANGED
|
@@ -3,15 +3,42 @@
|
|
|
3
3
|
> “I solve problems you face daily”
|
|
4
4
|
|
|
5
5
|
<p>
|
|
6
|
-
|
|
6
|
+
<!-- NPM Info -->
|
|
7
|
+
<a href="https://www.npmjs.com/package/nhb-toolbox" aria-label="NPM Downloads">
|
|
7
8
|
<img src="https://img.shields.io/npm/dm/nhb-toolbox.svg?label=DOWNLOADS&style=flat&color=red&logo=npm" alt="Downloads" />
|
|
8
9
|
</a>
|
|
9
|
-
<a href="https://www.npmjs.com/package/nhb-toolbox" aria-label="Version">
|
|
10
|
-
<img src="https://img.shields.io/npm/v/nhb-toolbox.svg?label=
|
|
10
|
+
<a href="https://www.npmjs.com/package/nhb-toolbox" aria-label="NPM Version">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/nhb-toolbox.svg?label=VERSION&style=flat&color=teal&logo=npm" alt="Latest Version" />
|
|
11
12
|
</a>
|
|
12
|
-
<a href="https://bundlephobia.com/result?p=nhb-toolbox" aria-label="Bundle
|
|
13
|
+
<a href="https://bundlephobia.com/result?p=nhb-toolbox" aria-label="Bundle Size">
|
|
13
14
|
<img src="https://img.shields.io/bundlephobia/minzip/nhb-toolbox?style=flat&color=purple&label=SIZE&logo=nodedotjs" alt="Bundle Size" />
|
|
14
15
|
</a>
|
|
16
|
+
|
|
17
|
+
<!-- Project Metadata -->
|
|
18
|
+
<a href="https://github.com/nazmul-nhb/nhb-toolbox" aria-label="TypeScript">
|
|
19
|
+
<img src="https://img.shields.io/badge/BUILT%20with-TypeScript-3178C6?style=flat&logo=typescript&logoColor=blue" alt="Built with TypeScript" />
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://github.com/nazmul-nhb/nhb-toolbox/actions" aria-label="Build Status">
|
|
22
|
+
<img src="https://img.shields.io/github/actions/workflow/status/nazmul-nhb/nhb-toolbox/publish.yml?label=BUILD%20%26%20PUBLISH&style=flat&logo=github" alt="Build Status" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://github.com/nazmul-nhb/nhb-toolbox" aria-label="Project Status">
|
|
25
|
+
<img src="https://img.shields.io/badge/STATUS-maintained-brightgreen?style=flat&logo=git" alt="Maintained" />
|
|
26
|
+
</a>
|
|
27
|
+
<a href="https://github.com/nazmul-nhb/nhb-toolbox/commits/main" aria-label="Last Commit">
|
|
28
|
+
<img src="https://img.shields.io/github/last-commit/nazmul-nhb/nhb-toolbox?style=flat&label=LAST%20COMMIT&logo=git" alt="Last Commit" />
|
|
29
|
+
</a>
|
|
30
|
+
|
|
31
|
+
<!-- GitHub Meta -->
|
|
32
|
+
<a href="https://github.com/nazmul-nhb/nhb-toolbox/stargazers" aria-label="GitHub Stars">
|
|
33
|
+
<img src="https://img.shields.io/github/stars/nazmul-nhb/nhb-toolbox?style=flat&label=STARS&logo=github" alt="GitHub stars" />
|
|
34
|
+
</a>
|
|
35
|
+
<a href="https://github.com/nazmul-nhb/nhb-toolbox/issues" aria-label="Open Issues">
|
|
36
|
+
<img src="https://img.shields.io/github/issues/nazmul-nhb/nhb-toolbox?style=flat&label=ISSUES&logo=github" alt="Open Issues" />
|
|
37
|
+
</a>
|
|
38
|
+
<a href="https://github.com/nazmul-nhb/nhb-toolbox/pulls" aria-label="Open Pull Requests">
|
|
39
|
+
<img src="https://img.shields.io/github/issues-pr/nazmul-nhb/nhb-toolbox?style=flat&label=PRs&logo=github" alt="Pull Requests" />
|
|
40
|
+
</a>
|
|
41
|
+
|
|
15
42
|
<a href="https://www.npmjs.com/package/nhb-toolbox" aria-label="License">
|
|
16
43
|
<img src="https://img.shields.io/npm/l/nhb-toolbox.svg?label=LICENSE&style=flat&color=orange&logo=open-source-initiative" alt="License" />
|
|
17
44
|
</a>
|
|
@@ -148,7 +175,7 @@ pluralizer.toSingular('children'); // "child"
|
|
|
148
175
|
|
|
149
176
|
pluralizer.isPlural('children'); // true
|
|
150
177
|
pluralizer.isSingular('child'); // true
|
|
151
|
-
pluralizer.isPlural('fish'); //
|
|
178
|
+
pluralizer.isPlural('fish'); // true (uncountable)
|
|
152
179
|
```
|
|
153
180
|
|
|
154
181
|
[Documentation →](https://nhb-toolbox.vercel.app/docs/utilities/string/pluralizer)
|
package/dist/cjs/date/Chronos.js
CHANGED
|
@@ -1078,13 +1078,15 @@ class Chronos {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
/**
|
|
1080
1080
|
* @instance Returns the current time zone name as a full descriptive string (e.g. `"Bangladesh Standard Time"`).
|
|
1081
|
+
* @param utc Optional UTC offset in `"UTC+06:00"` format. When passed, it bypasses the current time zone offset.
|
|
1082
|
+
* @returns Time zone name in full descriptive string or UTC offset if it is not a valid time zone.
|
|
1081
1083
|
* @remarks
|
|
1082
1084
|
* - This method uses a predefined mapping of UTC offsets to time zone names.
|
|
1083
1085
|
* - If multiple time zones share the same UTC offset, it returns the **first match** from the predefined list.
|
|
1084
1086
|
* - If no match is found (which is rare), it falls back to returning the UTC offset (e.g. `"UTC+06:00"`).
|
|
1085
1087
|
*/
|
|
1086
|
-
getTimeZoneName() {
|
|
1087
|
-
const UTC = `UTC${this.getTimeZoneOffset()}`;
|
|
1088
|
+
getTimeZoneName(utc) {
|
|
1089
|
+
const UTC = utc ?? `UTC${this.getTimeZoneOffset()}`;
|
|
1088
1090
|
return constants_1.TIME_ZONE_LABELS?.[UTC] ?? UTC;
|
|
1089
1091
|
}
|
|
1090
1092
|
/** @instance Returns new Chronos instance in UTC */
|
|
@@ -134,7 +134,7 @@ exports.TIME_ZONES = Object.freeze({
|
|
|
134
134
|
/** Acre Time (Brazil-West) */
|
|
135
135
|
ACT: -5 * 60,
|
|
136
136
|
/** Atlantic Standard Time (Canada-Maritime, Caribbean) */
|
|
137
|
-
AST: -4 * 60,
|
|
137
|
+
'AST-Atlantic': -4 * 60,
|
|
138
138
|
/** Bolivia Time */
|
|
139
139
|
BOT: -4 * 60,
|
|
140
140
|
/** Venezuelan Standard Time */
|
|
@@ -4,7 +4,7 @@ exports.timeZonePlugin = void 0;
|
|
|
4
4
|
const constants_1 = require("../constants");
|
|
5
5
|
const guards_1 = require("../guards");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
|
-
/** * Plugin to inject `timeZone`
|
|
7
|
+
/** * Plugin to inject `timeZone` related methods */
|
|
8
8
|
const timeZonePlugin = (ChronosClass) => {
|
|
9
9
|
ChronosClass.prototype.timeZone = function (zone) {
|
|
10
10
|
let targetOffset;
|
|
@@ -24,8 +24,8 @@ const timeZonePlugin = (ChronosClass) => {
|
|
|
24
24
|
const instance = new ChronosClass(adjustedTime);
|
|
25
25
|
return ChronosClass[constants_1.INTERNALS].withOrigin(instance, 'timeZone', stringOffset);
|
|
26
26
|
};
|
|
27
|
-
ChronosClass.prototype.getTimeZoneNameShort = function () {
|
|
28
|
-
const mins = this.getTimeZoneOffsetMinutes();
|
|
27
|
+
ChronosClass.prototype.getTimeZoneNameShort = function (utc) {
|
|
28
|
+
const mins = utc ? (0, utils_1.extractMinutesFromUTC)(utc) : this.getTimeZoneOffsetMinutes();
|
|
29
29
|
const UTC = (0, utils_1.formatUTCOffset)(mins);
|
|
30
30
|
const timeZone = constants_1.TIME_ZONE_LABELS?.[UTC];
|
|
31
31
|
let result = timeZone
|
|
@@ -219,9 +219,11 @@ class Pluralizer {
|
|
|
219
219
|
/**
|
|
220
220
|
* * Check if a given word is plural.
|
|
221
221
|
* @param word Word to check.
|
|
222
|
-
* @returns
|
|
222
|
+
* @returns `true` if the word is plural, otherwise `false`.
|
|
223
|
+
* @remarks Always returns `true` for uncountable nouns.
|
|
223
224
|
* @example
|
|
224
225
|
* pluralizer.isPlural('children'); // true
|
|
226
|
+
* pluralizer.isPlural('water'); // true
|
|
225
227
|
*/
|
|
226
228
|
isPlural(word) {
|
|
227
229
|
if (!(0, primitives_1.isNonEmptyString)(word))
|
|
@@ -242,8 +244,10 @@ class Pluralizer {
|
|
|
242
244
|
* * Check if a given word is singular.
|
|
243
245
|
* @param word Word to check.
|
|
244
246
|
* @returns True if the word is singular, otherwise false.
|
|
247
|
+
* @remarks Always returns `true` for uncountable nouns.
|
|
245
248
|
* @example
|
|
246
249
|
* pluralizer.isSingular('child'); // true
|
|
250
|
+
* pluralizer.isPlural('water'); // true
|
|
247
251
|
*/
|
|
248
252
|
isSingular(word) {
|
|
249
253
|
if (!(0, primitives_1.isNonEmptyString)(word))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Enumerate, LocaleCode, NumberRange } from '../number/types';
|
|
2
|
-
import type { TupleOf } from '../utils/types';
|
|
2
|
+
import type { LooseLiteral, TupleOf } from '../utils/types';
|
|
3
3
|
import { INTERNALS } from './constants';
|
|
4
|
-
import type { ChronosInput, ChronosInternals, ChronosMethods, ChronosObject, ChronosPlugin, DateRangeOptions, FormatOptions, MilliSecond, MonthName, Quarter, RangeWithDates, RelativeDateRange, RelativeRangeOptions, StrictFormat, TimeDuration, TimeParts, TimeUnit, WeekDay } from './types';
|
|
4
|
+
import type { ChronosInput, ChronosInternals, ChronosMethods, ChronosObject, ChronosPlugin, DateRangeOptions, FormatOptions, MilliSecond, MonthName, Quarter, RangeWithDates, RelativeDateRange, RelativeRangeOptions, StrictFormat, TimeDuration, TimeParts, TimeUnit, UTCOffSet, WeekDay } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* * Creates a new immutable `Chronos` instance.
|
|
7
7
|
*
|
|
@@ -494,12 +494,14 @@ export declare class Chronos {
|
|
|
494
494
|
getTimeZoneOffsetMinutes(): number;
|
|
495
495
|
/**
|
|
496
496
|
* @instance Returns the current time zone name as a full descriptive string (e.g. `"Bangladesh Standard Time"`).
|
|
497
|
+
* @param utc Optional UTC offset in `"UTC+06:00"` format. When passed, it bypasses the current time zone offset.
|
|
498
|
+
* @returns Time zone name in full descriptive string or UTC offset if it is not a valid time zone.
|
|
497
499
|
* @remarks
|
|
498
500
|
* - This method uses a predefined mapping of UTC offsets to time zone names.
|
|
499
501
|
* - If multiple time zones share the same UTC offset, it returns the **first match** from the predefined list.
|
|
500
502
|
* - If no match is found (which is rare), it falls back to returning the UTC offset (e.g. `"UTC+06:00"`).
|
|
501
503
|
*/
|
|
502
|
-
getTimeZoneName():
|
|
504
|
+
getTimeZoneName(utc?: UTCOffSet): LooseLiteral<UTCOffSet>;
|
|
503
505
|
/** @instance Returns new Chronos instance in UTC */
|
|
504
506
|
toUTC(): Chronos;
|
|
505
507
|
/** @instance Returns new Chronos instance in local time */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chronos.d.ts","sourceRoot":"","sources":["../../../src/date/Chronos.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Chronos.d.ts","sourceRoot":"","sources":["../../../src/date/Chronos.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAEN,SAAS,EAIT,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAEX,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAEhB,aAAa,EACb,WAAW,EACX,SAAS,EACT,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EAEP,MAAM,SAAS,CAAC;AAGjB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,OAAO;;IAOnB,yFAAyF;IACzF,SAAS,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAgB5C;IAEF;;;;OAIG;IACH,MAAM,EAAE,IAAI,CAAC;IAEb,yGAAyG;IACzG,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC;IAEhC;;;;;;OAMG;;IAGH;;;;;;OAMG;gBACS,KAAK,EAA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AC5B,MAAM,EAAE;IAEX;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,EAAE;IAqDzE;;;OAGG;IACH,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO;IAM7C;;;OAGG;IACH,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO;IAM7C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;IAgB9C;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI;IAIjD;;;;;;OAMG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM;IAIpD;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO;IAIvD;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;CAMvC"}
|
|
@@ -67,7 +67,7 @@ export declare const TIME_ZONES: Readonly<{
|
|
|
67
67
|
/** Acre Time (Brazil-West) */
|
|
68
68
|
readonly ACT: number;
|
|
69
69
|
/** Atlantic Standard Time (Canada-Maritime, Caribbean) */
|
|
70
|
-
readonly AST: number;
|
|
70
|
+
readonly 'AST-Atlantic': number;
|
|
71
71
|
/** Bolivia Time */
|
|
72
72
|
readonly BOT: number;
|
|
73
73
|
/** Venezuelan Standard Time */
|
|
@@ -12,15 +12,17 @@ declare module '../Chronos' {
|
|
|
12
12
|
timeZone(zone: TimeZone | UTCOffSet): ChronosConstructor;
|
|
13
13
|
/**
|
|
14
14
|
* @instance Returns the current time zone abbreviation (e.g. `"BST"` for `Bangladesh Standard Time`).
|
|
15
|
+
* @param utc Optional UTC offset in `"UTC+06:00"` format. When passed, it bypasses the current time zone offset.
|
|
16
|
+
* @returns Time zone name in full descriptive string or UTC offset if it is not a valid time zone.
|
|
15
17
|
* @remarks
|
|
16
18
|
* - This method uses a predefined mapping of UTC offsets to abbreviated time zone codes.
|
|
17
19
|
* - If multiple time zones share the same UTC offset, it returns the **first abbreviation** from the list.
|
|
18
20
|
* - If no match is found (which is rare), it returns the UTC offset (e.g. `"UTC+06:00"`).
|
|
19
21
|
*/
|
|
20
|
-
getTimeZoneNameShort(): TimeZone | UTCOffSet;
|
|
22
|
+
getTimeZoneNameShort(utc?: UTCOffSet): TimeZone | UTCOffSet;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
|
-
/** * Plugin to inject `timeZone`
|
|
25
|
+
/** * Plugin to inject `timeZone` related methods */
|
|
24
26
|
export declare const timeZonePlugin: (ChronosClass: MainChronos) => void;
|
|
25
27
|
export {};
|
|
26
28
|
//# sourceMappingURL=timeZonePlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeZonePlugin.d.ts","sourceRoot":"","sources":["../../../../src/date/plugins/timeZonePlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGpD,KAAK,kBAAkB,GAAG,OAAO,YAAY,EAAE,OAAO,CAAC;AACvD,KAAK,WAAW,GAAG,cAAc,YAAY,EAAE,OAAO,CAAC;AAEvD,OAAO,QAAQ,YAAY,CAAC;IAC3B,UAAU,OAAO;QAChB;;;;;WAKG;QACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,kBAAkB,CAAC;QAEzD
|
|
1
|
+
{"version":3,"file":"timeZonePlugin.d.ts","sourceRoot":"","sources":["../../../../src/date/plugins/timeZonePlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGpD,KAAK,kBAAkB,GAAG,OAAO,YAAY,EAAE,OAAO,CAAC;AACvD,KAAK,WAAW,GAAG,cAAc,YAAY,EAAE,OAAO,CAAC;AAEvD,OAAO,QAAQ,YAAY,CAAC;IAC3B,UAAU,OAAO;QAChB;;;;;WAKG;QACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,kBAAkB,CAAC;QAEzD;;;;;;;;WAQG;QACH,oBAAoB,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;KAC5D;CACD;AAED,oDAAoD;AACpD,eAAO,MAAM,cAAc,GAAI,cAAc,WAAW,KAAG,IA6D1D,CAAC"}
|
|
@@ -87,17 +87,21 @@ export declare class Pluralizer {
|
|
|
87
87
|
/**
|
|
88
88
|
* * Check if a given word is plural.
|
|
89
89
|
* @param word Word to check.
|
|
90
|
-
* @returns
|
|
90
|
+
* @returns `true` if the word is plural, otherwise `false`.
|
|
91
|
+
* @remarks Always returns `true` for uncountable nouns.
|
|
91
92
|
* @example
|
|
92
93
|
* pluralizer.isPlural('children'); // true
|
|
94
|
+
* pluralizer.isPlural('water'); // true
|
|
93
95
|
*/
|
|
94
96
|
isPlural(word: string): boolean;
|
|
95
97
|
/**
|
|
96
98
|
* * Check if a given word is singular.
|
|
97
99
|
* @param word Word to check.
|
|
98
100
|
* @returns True if the word is singular, otherwise false.
|
|
101
|
+
* @remarks Always returns `true` for uncountable nouns.
|
|
99
102
|
* @example
|
|
100
103
|
* pluralizer.isSingular('child'); // true
|
|
104
|
+
* pluralizer.isPlural('water'); // true
|
|
101
105
|
*/
|
|
102
106
|
isSingular(word: string): boolean;
|
|
103
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pluralizer.d.ts","sourceRoot":"","sources":["../../../src/pluralize/Pluralizer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAgB,gBAAgB,EAAiB,MAAM,SAA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IAAI;IAOlD;;;;;;;;OAQG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM;IAY/D;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiB9B;;;;;;OAMG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiBhC;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAc/B;;;;;;;;OAQG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAajC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
package/dist/esm/date/Chronos.js
CHANGED
|
@@ -1075,13 +1075,15 @@ export class Chronos {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
/**
|
|
1077
1077
|
* @instance Returns the current time zone name as a full descriptive string (e.g. `"Bangladesh Standard Time"`).
|
|
1078
|
+
* @param utc Optional UTC offset in `"UTC+06:00"` format. When passed, it bypasses the current time zone offset.
|
|
1079
|
+
* @returns Time zone name in full descriptive string or UTC offset if it is not a valid time zone.
|
|
1078
1080
|
* @remarks
|
|
1079
1081
|
* - This method uses a predefined mapping of UTC offsets to time zone names.
|
|
1080
1082
|
* - If multiple time zones share the same UTC offset, it returns the **first match** from the predefined list.
|
|
1081
1083
|
* - If no match is found (which is rare), it falls back to returning the UTC offset (e.g. `"UTC+06:00"`).
|
|
1082
1084
|
*/
|
|
1083
|
-
getTimeZoneName() {
|
|
1084
|
-
const UTC = `UTC${this.getTimeZoneOffset()}`;
|
|
1085
|
+
getTimeZoneName(utc) {
|
|
1086
|
+
const UTC = utc ?? `UTC${this.getTimeZoneOffset()}`;
|
|
1085
1087
|
return TIME_ZONE_LABELS?.[UTC] ?? UTC;
|
|
1086
1088
|
}
|
|
1087
1089
|
/** @instance Returns new Chronos instance in UTC */
|
|
@@ -131,7 +131,7 @@ export const TIME_ZONES = /* @__PURE__ */ Object.freeze({
|
|
|
131
131
|
/** Acre Time (Brazil-West) */
|
|
132
132
|
ACT: -5 * 60,
|
|
133
133
|
/** Atlantic Standard Time (Canada-Maritime, Caribbean) */
|
|
134
|
-
AST: -4 * 60,
|
|
134
|
+
'AST-Atlantic': -4 * 60,
|
|
135
135
|
/** Bolivia Time */
|
|
136
136
|
BOT: -4 * 60,
|
|
137
137
|
/** Venezuelan Standard Time */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { INTERNALS, TIME_ZONE_LABELS, TIME_ZONES } from '../constants.js';
|
|
2
2
|
import { isValidUTCOffSet } from '../guards.js';
|
|
3
3
|
import { extractMinutesFromUTC, formatUTCOffset } from '../utils.js';
|
|
4
|
-
/** * Plugin to inject `timeZone`
|
|
4
|
+
/** * Plugin to inject `timeZone` related methods */
|
|
5
5
|
export const timeZonePlugin = (ChronosClass) => {
|
|
6
6
|
ChronosClass.prototype.timeZone = function (zone) {
|
|
7
7
|
let targetOffset;
|
|
@@ -21,8 +21,8 @@ export const timeZonePlugin = (ChronosClass) => {
|
|
|
21
21
|
const instance = new ChronosClass(adjustedTime);
|
|
22
22
|
return ChronosClass[INTERNALS].withOrigin(instance, 'timeZone', stringOffset);
|
|
23
23
|
};
|
|
24
|
-
ChronosClass.prototype.getTimeZoneNameShort = function () {
|
|
25
|
-
const mins = this.getTimeZoneOffsetMinutes();
|
|
24
|
+
ChronosClass.prototype.getTimeZoneNameShort = function (utc) {
|
|
25
|
+
const mins = utc ? extractMinutesFromUTC(utc) : this.getTimeZoneOffsetMinutes();
|
|
26
26
|
const UTC = formatUTCOffset(mins);
|
|
27
27
|
const timeZone = TIME_ZONE_LABELS?.[UTC];
|
|
28
28
|
let result = timeZone
|
|
@@ -216,9 +216,11 @@ export class Pluralizer {
|
|
|
216
216
|
/**
|
|
217
217
|
* * Check if a given word is plural.
|
|
218
218
|
* @param word Word to check.
|
|
219
|
-
* @returns
|
|
219
|
+
* @returns `true` if the word is plural, otherwise `false`.
|
|
220
|
+
* @remarks Always returns `true` for uncountable nouns.
|
|
220
221
|
* @example
|
|
221
222
|
* pluralizer.isPlural('children'); // true
|
|
223
|
+
* pluralizer.isPlural('water'); // true
|
|
222
224
|
*/
|
|
223
225
|
isPlural(word) {
|
|
224
226
|
if (!isNonEmptyString(word))
|
|
@@ -239,8 +241,10 @@ export class Pluralizer {
|
|
|
239
241
|
* * Check if a given word is singular.
|
|
240
242
|
* @param word Word to check.
|
|
241
243
|
* @returns True if the word is singular, otherwise false.
|
|
244
|
+
* @remarks Always returns `true` for uncountable nouns.
|
|
242
245
|
* @example
|
|
243
246
|
* pluralizer.isSingular('child'); // true
|
|
247
|
+
* pluralizer.isPlural('water'); // true
|
|
244
248
|
*/
|
|
245
249
|
isSingular(word) {
|
|
246
250
|
if (!isNonEmptyString(word))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.10",
|
|
4
4
|
"description": "A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|