Express-validator 7.0.1 isDate() always return false

204 Views Asked by At

The following code works for express-validator 6.14.2.

const checkDate = check("date").isDate();

// simplified but you get the idea, 
app.post(
    "/path1",
    [checkDate],
    async (req, res) => {
        ... process the req ...
    }
); 

For my test, i have req.body = { date: "2021-02-12", ... }

It used to pass this date check on v6.14.2, but starts failing on v7.0.1. If i comment out this checkDate, then test is passing again.

I checked the changeLog but didn't see anything. Anyone knows why it's not working ? Thx !

1

There are 1 best solutions below

0
user3552178 On

Do not believe this is express-validator issue, should be related to yarn v1 or v3. Packages are messed up with yarn, e.g. https://github.com/storybookjs/storybook/issues/22431