最佳答案
由于我在 Cloud Firestore 上将 dueDate
字段存储为“时间戳”(而不是字符串或数字),因此我这样做了获取截止日期为 2017 年的发票文件:
let start = new Date('2017-01-01');
let end = new Date('2018-01-01');
this.afs.collection('invoices', ref => ref
.where('dueDate', '>', start)
.where('dueDate', '<', end)
);
注意: dueDate
字段使用 Date() 对象存储在 firebase 中。例如:this.doc.dueDate = new Date('2017-12-25')
关于javascript - 按日期范围的 Firestore 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47000854/