@@ -19,7 +19,7 @@ const isValidURITemplate = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#.
1919// Default Json-Schema formats: date-time, email, hostname, ipv4, ipv6, uri, uriref
2020const formatValidators = {
2121 date : ( draft , schema , value , pointer ) => {
22- if ( typeof value !== "string" ) {
22+ if ( typeof value !== "string" || value === "" ) {
2323 return undefined ;
2424 }
2525 // https://github.com/cfworker/cfworker/blob/main/packages/json-schema/src/format.ts
@@ -42,7 +42,7 @@ const formatValidators = {
4242 return errors . formatDateError ( { value, pointer, schema } ) ;
4343 } ,
4444 "date-time" : ( draft , schema , value , pointer ) => {
45- if ( typeof value !== "string" ) {
45+ if ( typeof value !== "string" || value === "" ) {
4646 return undefined ;
4747 }
4848 if ( value === "" || isValidDateTime . test ( value ) ) {
@@ -55,7 +55,7 @@ const formatValidators = {
5555 } ,
5656 email : ( draft , schema , value , pointer ) => {
5757 // taken from https://github.com/ExodusMovement/schemasafe/blob/master/src/formats.js
58- if ( typeof value !== "string" ) {
58+ if ( typeof value !== "string" || value === "" ) {
5959 return undefined ;
6060 }
6161 if ( value [ 0 ] === '"' ) {
@@ -145,7 +145,7 @@ const formatValidators = {
145145 return errors . formatRegExError ( { value, pointer, schema } ) ;
146146 } ,
147147 time : ( draft , schema , value , pointer ) => {
148- if ( typeof value !== "string" ) {
148+ if ( typeof value !== "string" || value === "" ) {
149149 return undefined ;
150150 }
151151 // https://github.com/cfworker/cfworker/blob/main/packages/json-schema/src/format.ts
0 commit comments