my-timezone 1.15.3 → 1.15.4
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/dist/MyTimezone.js +8 -10
- package/package.json +10 -7
package/dist/MyTimezone.js
CHANGED
|
@@ -77,18 +77,16 @@ export class MyTimezone {
|
|
|
77
77
|
}
|
|
78
78
|
parseCoordinates(coordinates) {
|
|
79
79
|
var _a;
|
|
80
|
-
const coordinatesRegex =
|
|
80
|
+
const coordinatesRegex = /^(?:\s*[+-]?(?:\d+(?:\.\d*)?|\.\d+)\s*,)?\s*(?<longitude>[+-]?(?:\d+(?:\.\d*)?|\.\d+))\s*$/;
|
|
81
81
|
const parsedRegex = coordinatesRegex.exec(coordinates);
|
|
82
|
-
if ((_a = parsedRegex === null || parsedRegex === void 0 ? void 0 : parsedRegex.groups) === null || _a === void 0 ? void 0 : _a.longitude) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
throw new Error(`Invalid coordinates: "${coordinates}"`);
|
|
89
|
-
}
|
|
82
|
+
if (!((_a = parsedRegex === null || parsedRegex === void 0 ? void 0 : parsedRegex.groups) === null || _a === void 0 ? void 0 : _a.longitude)) {
|
|
83
|
+
throw new Error(`No coordinates parsed: "${coordinates}"`);
|
|
84
|
+
}
|
|
85
|
+
const longitude = parseFloat(parsedRegex.groups.longitude);
|
|
86
|
+
if (Number.isNaN(longitude)) {
|
|
87
|
+
throw new Error(`Invalid coordinates: "${coordinates}"`);
|
|
90
88
|
}
|
|
91
|
-
|
|
89
|
+
return { longitude };
|
|
92
90
|
}
|
|
93
91
|
parseDate(date) {
|
|
94
92
|
const isoString = date.toISOString();
|
package/package.json
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"bin": "dist/cli.js",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"commander": "14.0.3",
|
|
6
|
-
"ntpclient": "1.16.
|
|
6
|
+
"ntpclient": "1.16.2"
|
|
7
7
|
},
|
|
8
8
|
"description": "Calculate the true solar time at any geographic location.",
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"nock": "14.0.
|
|
11
|
-
"tsx": "4.
|
|
12
|
-
"typescript": "6.0.
|
|
13
|
-
"vitest": "4.1.
|
|
10
|
+
"nock": "14.0.15",
|
|
11
|
+
"tsx": "4.22.0",
|
|
12
|
+
"typescript": "6.0.3",
|
|
13
|
+
"vitest": "4.1.6"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">= 21"
|
|
@@ -23,7 +23,10 @@
|
|
|
23
23
|
"module": "dist/index.js",
|
|
24
24
|
"name": "my-timezone",
|
|
25
25
|
"readme": "https://github.com/ffflorian/node-packages#readme",
|
|
26
|
-
"repository":
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/ffflorian/node-packages.git"
|
|
29
|
+
},
|
|
27
30
|
"scripts": {
|
|
28
31
|
"build": "tsc -p tsconfig.build.json",
|
|
29
32
|
"clean": "rm -rf dist",
|
|
@@ -32,5 +35,5 @@
|
|
|
32
35
|
"test": "vitest run"
|
|
33
36
|
},
|
|
34
37
|
"type": "module",
|
|
35
|
-
"version": "1.15.
|
|
38
|
+
"version": "1.15.4"
|
|
36
39
|
}
|