Skip to content

Commit 6a805de

Browse files
committed
fix ajv format for dates
1 parent 345511c commit 6a805de

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/* eslint no-prototype-builtins: 0 */
44

55
const Ajv = require('ajv').default
6+
const ajvFormats = require('ajv-formats')
67
const merge = require('deepmerge')
78
const clone = require('rfdc')({ proto: true })
89
const fjsCloned = Symbol('fast-json-stringify.cloned')
@@ -158,7 +159,9 @@ function build (schema, options) {
158159
return ${main}
159160
`
160161

161-
const dependencies = [new Ajv(options.ajv)]
162+
const ajvInstance = new Ajv(options.ajv)
163+
ajvFormats(ajvInstance)
164+
const dependencies = [ajvInstance]
162165
const dependenciesName = ['ajv']
163166
dependenciesName.push(code)
164167

@@ -1317,7 +1320,9 @@ module.exports.restore = function (debugModeStr, options = {}) {
13171320
const args = []
13181321
if (debugModeStr.startsWith('ajv')) {
13191322
dependencies.unshift('ajv')
1320-
args.push(new Ajv(options.ajv))
1323+
const ajvInstance = new Ajv(options.ajv)
1324+
ajvFormats(ajvInstance)
1325+
args.push(ajvInstance)
13211326
}
13221327

13231328
// eslint-disable-next-line

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
},
4545
"dependencies": {
4646
"ajv": "^7.2.3",
47+
"ajv-formats": "^1.6.1",
4748
"deepmerge": "^4.2.2",
4849
"rfdc": "^1.2.0",
4950
"string-similarity": "^4.0.1"

0 commit comments

Comments
 (0)