Skip to content

What is the exact ISO 8601 format for isDate() ? #2336

Open
@ningji

Description

@ningji

Describe the bug
isDate("2020-06-15") is failing on 13.11.0, which is called from express-validator.
it used to work on 13.7.0.

const validator = require('validator');
const rt = validator.isDate('2022-06-15');
console.log(rt);

it prints false

Examples
isData("2020-06-15") was working on 13.7.0

I realized there's a change on 13.11.0
#2231
and changed my code to
isDate("2012-03-29T10:05:45-06:00") but still fails.

doesn't like "2012-03-29T10:05:45.000Z" either.

this format is from the online search on ISO 8601 date format
https://www.digi.com/resources/documentation/digidocs/90001488-13/reference/r_iso_8601_date_format.htm

My question is, what's the good example to pass isDate() ? thanks !

Additional context
Validator.js version: 13.11.0
Node.js version: 16.16.0
OS platform: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions