ajv-validator / ajv-validator/ajv-formats
“compare is not a function” when using formatMinimum with date format
- 主要语言
- TypeScript
- 星标
- 228
- 派生
- 42
- PR 合并指标
- 30 天内没有已合并 PR
描述
This is my schema (with unrelated properties removed):
```js
export const employeeSchema = {
items: {
properties: {
launchDate: {
errorMessage: {
format: 'must be a date in YYYY-MM-DD format (e.g. _1973-05-11_)',
type: 'required, and must be a date in YYYY-MM-DD format (e.g. _1973-05-11_)',
},
examples: ['1973-05-11'],
format: 'date',
type: 'string',
},
},
required: [
'launchDate',
],
type: 'object',
},
minItems: 1,
type: 'array',
};
```
As-is, everything works and validates correctly. But when I add `formatMinimum` to `launchDate`:
```js
export const employeeSchema = {
items: {
properties: {
launchDate: {
errorMessage: {
format: 'must be a date in YYYY-MM-DD format (e.g. _1973-05-11_)',
type: 'required, and must be a date in YYYY-MM-DD format (e.g. _1973-05-11_)',
},
examples: ['1973-05-11'],
format: 'date',
formatMinimum: '2022-03-30',
type: 'string',
},
},
required: [
'launchDate',
],
type: 'object',
},
minItems: 1,
type: 'array',
};
```
… I get the following console error:
```
Uncaught TypeError: {(intermediate value)(intermediate value)(intermediate value)(intermediate value)}.compare is not a function
at validate14 (eval at compileSchema (index.jss:89:1), :3:2858)
at index.jss:149:1
at mountMemo (react-dom.development.jss:15846:1)
at Object.useMemo (react-dom.development.jss:16219:1)
at useMemo (react.development.jss:1532:1)
at UseMemo (whyDidYouRender.jss:1461:1)
at ModalImportReview (index.jss:132:1)
at renderWithHooks (react-dom.development.jss:14985:1)
at mountIndeterminateComponent (react-dom.development.jss:17811:1)
at beginWork (react-dom.development.jss:19049:1)
```
### Update:
RunKit example: https://runkit.com/brandondurham/compare-is-not-a-function-when-using-formatminimum-with-date-format
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。