Skip to content

Commit

Permalink
Updates isDateString() regular expression to add escape for digit (ep…
Browse files Browse the repository at this point in the history
…iphone#69)

* Updates isDateString() regular expression to add escape for digit

* Prettier updates
  • Loading branch information
mcheale-parkit authored Jul 10, 2021
1 parent 5ad7f3c commit d413f08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion __tests__/defaultConverters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ describe('defaultConverters', () => {

isBooleanString: { type: 'string', enum: ['true', 'false'] },
isDateString: {
pattern: 'd{4}-[01]d-[0-3]dT[0-2]d:[0-5]d:[0-5]d.d+Z?',
pattern:
'\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+Z?',
type: 'string',
},
isNumberString: { pattern: '^[-+]?[0-9]+$', type: 'string' },
Expand Down
2 changes: 1 addition & 1 deletion src/defaultConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const defaultConverters: ISchemaConverters = {
type: 'string',
},
[cv.IS_DATE_STRING]: {
pattern: 'd{4}-[01]d-[0-3]dT[0-2]d:[0-5]d:[0-5]d.d+Z?',
pattern: '\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d.\\d+Z?',
type: 'string',
},
[cv.IS_ARRAY]: {
Expand Down

0 comments on commit d413f08

Please sign in to comment.