valgen 5.19.4 → 5.19.5
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/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ export function isDateString(options) {
|
|
|
50
50
|
if (parsed.precision < precisionMinIdx) {
|
|
51
51
|
context.fail(_this, `Minimum date precision should be ${precisionMin}`, input, options);
|
|
52
52
|
}
|
|
53
|
-
if (parsed.precision > precisionMaxIdx) {
|
|
53
|
+
if (parsed.precision > precisionMaxIdx && !(input instanceof Date)) {
|
|
54
54
|
context.fail(_this, `Maximum date precision should be ${precisionMax}`, input, options);
|
|
55
55
|
}
|
|
56
56
|
return coerce ? parsed.value : input;
|
|
@@ -75,8 +75,11 @@ function coerceDateString(input, trimPrecision) {
|
|
|
75
75
|
String(d.getMinutes()).padStart(2, '0'),
|
|
76
76
|
String(d.getSeconds()).padStart(2, '0'),
|
|
77
77
|
];
|
|
78
|
-
if (precisionIndex >= 7
|
|
79
|
-
|
|
78
|
+
if (precisionIndex >= 7)
|
|
79
|
+
if (d.getMilliseconds() > 0)
|
|
80
|
+
dateParts.push(String(d.getMilliseconds()).padStart(3, '0'));
|
|
81
|
+
else
|
|
82
|
+
dateParts.push('');
|
|
80
83
|
if (precisionIndex >= 8) {
|
|
81
84
|
const tzOffset = d.getTimezoneOffset();
|
|
82
85
|
const tz = tzOffset > 0
|
|
@@ -13,7 +13,6 @@ export function isEnum(values, options) {
|
|
|
13
13
|
if (values[k] != null)
|
|
14
14
|
a.push(values[k]);
|
|
15
15
|
return a;
|
|
16
|
-
// v => !(typeof v === 'number' && !keys.includes(String(v))),
|
|
17
16
|
}, []);
|
|
18
17
|
}
|
|
19
18
|
const valObj = (Array.isArray(values) ? values : [values]).reduce((a, v) => {
|