ajv-validator / ajv-validator/ajv-formats
date-time accept timestamp without time zone
- Ngôn ngữ chính
- TypeScript
- Star
- 228
- Fork
- 42
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
According to ajv-formats documentation, "date-time" format specify that _time-zone is mandatory_. Unfortunately since full validation mode format has been added, it seems that time-zone is not mandatory anymore:
```javascript
import ajvFormats from "ajv-formats"
const dateWithoutTimeZone = '2022-07-06T13:12:43';
const dateWithTimeZone = '2022-07-06T13:12:43Z';
// validation with new full format mode does not work as expected
console.log(ajvFormats.get("date-time").validate(dateWithoutTimeZone)) // true => should return false
console.log(ajvFormats.get("date-time").validate(dateWithTimeZone)) // true => ok
// validation with fast format mode is ok
console.log(new RegExp(ajvFormats.get("date-time", "fast").validate).test(dateWithoutTimeZone)) // false => ok
console.log(new RegExp(ajvFormats.get("date-time", "fast").validate).test(dateWithTimeZone)) // true => ok
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.