date-vir 0.1.0 → 0.1.1
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.
|
@@ -33,11 +33,16 @@ exports.parseStrangeString = parseStrangeString;
|
|
|
33
33
|
*/
|
|
34
34
|
function parseInputElementValue(elementOrValue, timezone) {
|
|
35
35
|
if (!elementOrValue) {
|
|
36
|
-
|
|
36
|
+
return undefined;
|
|
37
37
|
}
|
|
38
38
|
const value = (0, common_1.isRuntimeTypeOf)(elementOrValue, 'string')
|
|
39
39
|
? elementOrValue
|
|
40
40
|
: elementOrValue.value;
|
|
41
|
-
|
|
41
|
+
try {
|
|
42
|
+
return (0, create_full_date_1.createFullDate)(value, timezone);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
exports.parseInputElementValue = parseInputElementValue;
|
|
@@ -24,4 +24,4 @@ export declare function parseStrangeString({ dateString, formatString, timezone,
|
|
|
24
24
|
* Read either an HTMLInputElement's value directly, or the value string retrieved from an
|
|
25
25
|
* HTMLInputElement. Handles both type="date" and type="time" <input> elements.
|
|
26
26
|
*/
|
|
27
|
-
export declare function parseInputElementValue(elementOrValue: HTMLInputElement | string | null | undefined, timezone: Timezone): FullDate;
|
|
27
|
+
export declare function parseInputElementValue(elementOrValue: HTMLInputElement | string | null | undefined, timezone: Timezone): FullDate | undefined;
|
|
@@ -33,11 +33,16 @@ exports.parseStrangeString = parseStrangeString;
|
|
|
33
33
|
*/
|
|
34
34
|
function parseInputElementValue(elementOrValue, timezone) {
|
|
35
35
|
if (!elementOrValue) {
|
|
36
|
-
|
|
36
|
+
return undefined;
|
|
37
37
|
}
|
|
38
38
|
const value = (0, common_1.isRuntimeTypeOf)(elementOrValue, 'string')
|
|
39
39
|
? elementOrValue
|
|
40
40
|
: elementOrValue.value;
|
|
41
|
-
|
|
41
|
+
try {
|
|
42
|
+
return (0, create_full_date_1.createFullDate)(value, timezone);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
exports.parseInputElementValue = parseInputElementValue;
|