nhb-toolbox 4.31.0 → 4.31.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.
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
All notable changes to the package will be documented here.
|
|
6
6
|
|
|
7
|
+
## [4.31.1] - 2026-06-28
|
|
8
|
+
|
|
9
|
+
- **Fixed** immutability issue with conversion to `Date` object for all the *date utilities* including `Chronos` constructor and plugins.
|
|
10
|
+
|
|
7
11
|
## [4.31.0] - 2026-06-16
|
|
8
12
|
|
|
9
13
|
- **Added** new *methods* for `Color` class: `toString()`, `toJSON()`, `Symbol.toPrimitive`.
|
package/dist/cjs/date/Chronos.js
CHANGED
|
@@ -105,7 +105,7 @@ class Chronos {
|
|
|
105
105
|
#toNewDate(value) {
|
|
106
106
|
const date = value instanceof _a ? value.toDate() : (0, helpers_1._dateArgsToDate)(value);
|
|
107
107
|
if (Number.isNaN(date.getTime())) {
|
|
108
|
-
throw new
|
|
108
|
+
throw new TypeError('Provided date is invalid!');
|
|
109
109
|
}
|
|
110
110
|
return date;
|
|
111
111
|
}
|
package/dist/cjs/date/helpers.js
CHANGED
|
@@ -156,9 +156,11 @@ function _padShunno(str, length = 2) {
|
|
|
156
156
|
return str.padStart(length, '০');
|
|
157
157
|
}
|
|
158
158
|
function _dateArgsToDate(value) {
|
|
159
|
-
return (0, non_primitives_1.isDate)(value)
|
|
159
|
+
return new Date((0, non_primitives_1.isDate)(value)
|
|
160
160
|
? value
|
|
161
|
-
:
|
|
161
|
+
: (0, primitives_1.isString)(value)
|
|
162
|
+
? value.replace(/['"]/g, '')
|
|
163
|
+
: (value ?? Date.now()));
|
|
162
164
|
}
|
|
163
165
|
function _hasChronosProperties(value) {
|
|
164
166
|
return ((0, non_primitives_1.isObjectWithKeys)(value, [
|
package/dist/esm/date/Chronos.js
CHANGED
|
@@ -102,7 +102,7 @@ export class Chronos {
|
|
|
102
102
|
#toNewDate(value) {
|
|
103
103
|
const date = value instanceof _a ? value.toDate() : _dateArgsToDate(value);
|
|
104
104
|
if (Number.isNaN(date.getTime())) {
|
|
105
|
-
throw new
|
|
105
|
+
throw new TypeError('Provided date is invalid!');
|
|
106
106
|
}
|
|
107
107
|
return date;
|
|
108
108
|
}
|
package/dist/esm/date/helpers.js
CHANGED
|
@@ -134,9 +134,11 @@ export function _padShunno(str, length = 2) {
|
|
|
134
134
|
return str.padStart(length, '০');
|
|
135
135
|
}
|
|
136
136
|
export function _dateArgsToDate(value) {
|
|
137
|
-
return isDate(value)
|
|
137
|
+
return new Date(isDate(value)
|
|
138
138
|
? value
|
|
139
|
-
:
|
|
139
|
+
: isString(value)
|
|
140
|
+
? value.replace(/['"]/g, '')
|
|
141
|
+
: (value ?? Date.now()));
|
|
140
142
|
}
|
|
141
143
|
export function _hasChronosProperties(value) {
|
|
142
144
|
return (isObjectWithKeys(value, [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nhb-toolbox",
|
|
3
|
-
"version": "4.31.
|
|
3
|
+
"version": "4.31.1",
|
|
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,12 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"license": "Apache-2.0",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@biomejs/biome": "^2.5.
|
|
47
|
+
"@biomejs/biome": "^2.5.1",
|
|
48
48
|
"@types/jest": "^30.0.0",
|
|
49
|
-
"@types/node": "^
|
|
49
|
+
"@types/node": "^26.0.1",
|
|
50
50
|
"husky": "^9.1.7",
|
|
51
51
|
"jest": "^30.4.2",
|
|
52
|
-
"lint-staged": "^17.0.
|
|
52
|
+
"lint-staged": "^17.0.8",
|
|
53
53
|
"nhb-scripts": "^1.9.2",
|
|
54
54
|
"ts-jest": "^29.4.11",
|
|
55
55
|
"typescript": "^6.0.3"
|