fix: date-time string validation to fail validating for date-only strings instead of throwing a TypeError
parent
af1f77166d
commit
6df7b2040b
|
@ -90,6 +90,8 @@ function date(str) {
|
|||
|
||||
|
||||
function time(str, full) {
|
||||
if (str === undefined) return false;
|
||||
|
||||
var matches = str.match(TIME);
|
||||
if (!matches) return false;
|
||||
|
||||
|
|
|
@ -100,6 +100,22 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "validation of date-time strings",
|
||||
"schema": {"format": "date-time"},
|
||||
"tests": [
|
||||
{
|
||||
"description": "a valid date-time string",
|
||||
"data": "1963-06-19T12:13:14Z",
|
||||
"valid": true
|
||||
},
|
||||
{
|
||||
"description": "an invalid date-time string",
|
||||
"data": "1963-06-19",
|
||||
"valid": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "validation of uuid strings",
|
||||
"schema": {"format": "uuid"},
|
||||
|
|
Loading…
Reference in New Issue