my-timezone 1.15.2 → 1.15.3
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/README.md +2 -2
- package/dist/MyTimezone.js +2 -2
- package/dist/cli.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Calculate the true solar time at any geographic location based on its longitude.
|
|
4
4
|
|
|
5
|
-
This is **not** political timezone data (UTC+1, DST, etc.) — it is [local mean time](https://en.wikipedia.org/wiki/Solar_time#Mean_solar_time): the astronomically correct time at a given longitude, where every degree equals exactly 4 minutes of offset from UTC. See [CS4FN](http://www.cs4fn.org/mobile/owntimezone.php) for a good explanation of the underlying concept.
|
|
5
|
+
This is **not** political timezone data (UTC+1, DST, etc.) — it is [local mean time](https://en.wikipedia.org/wiki/Solar_time#Mean_solar_time): the astronomically correct time at a given longitude, where every degree equals exactly 4 minutes of offset from UTC. See [this article on CS4FN](https://web.archive.org/web/20250914163157/http://www.cs4fn.org/mobile/owntimezone.php) for a good explanation of the underlying concept.
|
|
6
6
|
|
|
7
7
|
## Prerequisites
|
|
8
8
|
|
|
@@ -45,7 +45,7 @@ new MyTimezone()
|
|
|
45
45
|
Usage: my-timezone [options] <location>
|
|
46
46
|
|
|
47
47
|
Get the true solar time based on your location.
|
|
48
|
-
Use a city name or longitude value as location.
|
|
48
|
+
Use a city name or longitude value (e.g. "13.39") as location.
|
|
49
49
|
|
|
50
50
|
Options:
|
|
51
51
|
|
package/dist/MyTimezone.js
CHANGED
|
@@ -77,8 +77,8 @@ export class MyTimezone {
|
|
|
77
77
|
}
|
|
78
78
|
parseCoordinates(coordinates) {
|
|
79
79
|
var _a;
|
|
80
|
-
const
|
|
81
|
-
const parsedRegex =
|
|
80
|
+
const coordinatesRegex = new RegExp('([-?\\W\\d\\.]+,)?(?<longitude>[-?\\W\\d\\.]+)');
|
|
81
|
+
const parsedRegex = coordinatesRegex.exec(coordinates);
|
|
82
82
|
if ((_a = parsedRegex === null || parsedRegex === void 0 ? void 0 : parsedRegex.groups) === null || _a === void 0 ? void 0 : _a.longitude) {
|
|
83
83
|
try {
|
|
84
84
|
const longitude = parseFloat(parsedRegex.groups.longitude);
|
package/dist/cli.js
CHANGED
|
@@ -9,7 +9,7 @@ const { description, name, version } = JSON.parse(await fs.readFile(packageJsonP
|
|
|
9
9
|
commander
|
|
10
10
|
.name(name)
|
|
11
11
|
.version(version)
|
|
12
|
-
.description(`${description}\nUse a city name or longitude value as location.`)
|
|
12
|
+
.description(`${description}\nUse a city name or longitude value (e.g. "13.39") as location.`)
|
|
13
13
|
.option('-o, --offline', 'Work offline (default is false)')
|
|
14
14
|
.option('-s, --server <server>', 'Specify the NTP server (default is "pool.ntp.org")')
|
|
15
15
|
.argument('<location>')
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"nock": "14.0.11",
|
|
11
11
|
"tsx": "4.21.0",
|
|
12
12
|
"typescript": "6.0.2",
|
|
13
|
-
"vitest": "4.1.
|
|
13
|
+
"vitest": "4.1.2"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">= 21"
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"test": "vitest run"
|
|
33
33
|
},
|
|
34
34
|
"type": "module",
|
|
35
|
-
"version": "1.15.
|
|
35
|
+
"version": "1.15.3"
|
|
36
36
|
}
|