Hi!
I’m using the AngularFirestore to get data from a firebase database into my ionic application. In the collection I have a field (called “Start”) with a timestamp, and want to filter out documents where the timestamp is in the future.
I tried to use the lambda expression below, but my IDE tells me that “Property ‘Start’ does not exist on type ‘Items[]’”. Does anyone know how to solve the problem?
public itemsCollection: AngularFirestoreCollection<Items>;
public items: Observable<Items[]>;
constructor(public afd: AngularFirestore) {
this.itemsCollection = this.afd.collection('itemCollection');
this.items = this.itemsCollection.valueChanges();
var currentDate = new Date().getTime();
this.itemsCollection.valueChanges()
.filter ((data) => new Date(data.Start).getTime() < currentDate)
.subscribe ((data2) => console.log(data2));
}
I also tried to use an interface, but if doesn’t make any difference.
interface Items {
....
....
Start;
....
....
}