mdtg 4.1.0 → 4.1.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdtg",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "type": "module",
@@ -18,11 +18,12 @@
18
18
  "bench": "vitest bench --run",
19
19
  "coverage": "vitest run --coverage",
20
20
  "format": "biome check .",
21
+ "knip": "knip",
21
22
  "prelint": "npm run format && npm run prettier",
22
23
  "lint": "biome lint .",
23
- "knip": "knip",
24
24
  "prettier": "prettier **/*.yml",
25
- "test": "vitest run"
25
+ "test": "vitest run",
26
+ "test:mutation": "stryker run"
26
27
  },
27
28
  "keywords": [
28
29
  "military",
@@ -34,6 +35,7 @@
34
35
  "description": "This package offers you methods to convert Date Objects to military date time and vice versa",
35
36
  "devDependencies": {
36
37
  "@biomejs/biome": "2.5.15",
38
+ "@stryker-mutator/core": "10.0.0",
37
39
  "@vitest/coverage-v8": "5.0.3",
38
40
  "knip": "6.39.0",
39
41
  "prettier": "3.9.9",
package/src/constants.js CHANGED
@@ -42,7 +42,7 @@ export const OFFSETS = Object.freeze({
42
42
  M: -13,
43
43
  });
44
44
 
45
- export const SHORT_FORMAT_REGEX = /^[0-9]{6}[A-Z]$/;
45
+ export const SHORT_FORMAT_REGEX = /^[0-9]{6}[A-Z]$/i;
46
46
  export const STANDARD_FORMAT_REGEX =
47
47
  /^[0-9]{6}[A-Z](jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[0-9]{2}$/i;
48
48
  export const EXTENDED_FORMAT_REGEX =
package/src/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
+ type MDTGFormat = "short" | "extended" | "standard";
2
+
1
3
  declare function formatMDTG(
2
4
  date?: Date,
3
- options?: { form?: "short" | "extended" | "standard"; timezone?: string },
5
+ options?: { form?: MDTGFormat; timezone?: string },
4
6
  ): string;
5
7
 
6
8
  declare function isValidMDTG(
@@ -17,6 +19,8 @@ declare function isMDTG(mdtg: string): boolean;
17
19
  declare function isShortFormat(mdtg: string): boolean;
18
20
  declare function isStandardFormat(mdtg: string): boolean;
19
21
 
22
+ export type { MDTGFormat };
23
+
20
24
  export {
21
25
  formatMDTG,
22
26
  isExtendedFormat,
package/src/validation.js CHANGED
@@ -24,7 +24,7 @@ export const validateDate = (date) => {
24
24
  };
25
25
 
26
26
  export const validateTimezone = (timezone) => {
27
- const key = timezone?.toUpperCase();
27
+ const key = typeof timezone === "string" ? timezone.toUpperCase() : "Z";
28
28
  return key in OFFSETS ? key : "Z";
29
29
  };
30
30