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

前端 未结 3 569
天命终不由人
天命终不由人 2021-02-11 01:51

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:26

    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

提交回复
热议问题