我的要求是将日期参数传递给API,后端使用的是MongoDB,我正在尝试从angular传递日期参数,如下所示:
this.payload.criteria = {
"createdAt": { "$gte": moment('08-01-2021').toDate() }
}
记录存在于2021年8月1日,但我收到的回复是空的,因为这个[]
试着通过这样的东西:
var newdate = new Date("2021-01-07T09:27:08.433+00:00")
this.payload.criteria = {
"createdAt": { "$gte": newdate }
}
什么都不管用,你知道什么是正确的格式吗?
试试这个:
var newdate = new Date("2021-01-07T09:27:08.433+00:00")
new
this.payload.criteria = {
"createdAt": { "$gte": newdate.toISOString() }
}