简体   繁体   中英

Sails.js find() date

The following queries return an empty array although my database has records in the given date.

    Event.find({date: "2016-12-25"}).exec((err, holidays) => {
    console.log(holidays);
    }

let myDate = new Date(parameters.year,parameters.month,parameters.day);
  Event.find({date: myDate}).exec((err, holidays) => {
    console.log(holidays);
    }

Anything I'm missing?

根据文档,您可以这样做:

Model.find({ date: { '=': new Date('2/7/2014') } })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM