I am currently working on converting a timestamp
object from Firestore to a Date
object in TypeScript by utilizing the toDate()
method.
import { AngularFirestore } from '@angular/fire/firestore';
...
constructor(private database?: AngularFirestore) {...}
...
const someVariable = a.date.toDate();
While this functionality is operational in development mode, I have encountered a TypeScript compile check error. Additionally, building the prod version (with ng prod
) is proving challenging due to this error.
a.date.toDate() ~~~~ src/app/project/some.service.ts:74:36 -
error TS2339: Property 'toDate' does not exist on type 'Date'.
Does anyone have suggestions on how to address this issue?