mdtg 4.1.4 → 4.1.6
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/package.json +6 -3
- package/src/constants.js +0 -1
- package/src/format.js +1 -4
- package/src/validation.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdtg",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.6",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -28,14 +28,17 @@
|
|
|
28
28
|
"keywords": [
|
|
29
29
|
"military",
|
|
30
30
|
"date",
|
|
31
|
+
"date time group",
|
|
32
|
+
"dtg",
|
|
31
33
|
"time"
|
|
32
34
|
],
|
|
33
35
|
"author": "0xflotus",
|
|
34
36
|
"license": "MIT",
|
|
35
|
-
"description": "This package offers you methods to convert Date Objects to military date time and vice versa",
|
|
37
|
+
"description": "This package offers you methods to convert Date Objects to military date time group and vice versa",
|
|
36
38
|
"devDependencies": {
|
|
37
39
|
"@biomejs/biome": "2.5.15",
|
|
38
|
-
"@stryker-
|
|
40
|
+
"@systemfsoftware/stryker-js": "15.0.1",
|
|
41
|
+
"@systemfsoftware/stryker-js-vitest-runner": "8.0.3",
|
|
39
42
|
"@vitest/coverage-v8": "5.0.3",
|
|
40
43
|
"knip": "6.39.0",
|
|
41
44
|
"prettier": "3.9.9",
|
package/src/constants.js
CHANGED
package/src/format.js
CHANGED
|
@@ -51,10 +51,7 @@ const buildStandard = (date, timezone) => {
|
|
|
51
51
|
return result;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
export const formatMDTG = (
|
|
55
|
-
date = new Date(),
|
|
56
|
-
{ form = FORM.EXTENDED, timezone: timezoneInput = "Z" } = {},
|
|
57
|
-
) => {
|
|
54
|
+
export const formatMDTG = (date = new Date(), { form, timezone: timezoneInput } = {}) => {
|
|
58
55
|
validateDate(date);
|
|
59
56
|
|
|
60
57
|
const timezone = validateTimezone(timezoneInput);
|
package/src/validation.js
CHANGED
|
@@ -23,7 +23,9 @@ export const validateDate = (date) => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export const validateTimezone = (timezone) => {
|
|
26
|
-
|
|
26
|
+
if (typeof timezone !== "string") return "Z";
|
|
27
|
+
|
|
28
|
+
const key = timezone.toUpperCase();
|
|
27
29
|
return key in OFFSETS ? key : "Z";
|
|
28
30
|
};
|
|
29
31
|
|