Mongoose: Cast to date failed for value when updating a document

前端 未结 3 751
小鲜肉
小鲜肉 2021-02-11 01:57

I use Mongoose in my project and in one of the schemas I use Date field, like this:

reservationDay: {
        type: Date,
        default: Date.now
}
         


        
3条回答
  •  野性不改
    2021-02-11 02:32

    I would like to update one point from my mistake.

    check if you have missed leading zero for a single digit time.

    "2017-01-01T8:00:00" is invalid and will give the mentioned error.

    "2017-01-01T08:00:00" is valid

提交回复
热议问题