Answers for "firestore timestamp to date javascript"

1

convert firestore timnestamp to javascript

new Date(firebase.firestore.Timestamp.now().seconds*1000).toLocaleDateString()
Posted by: Guest on April-20-2021
0

firebase timestamp to date angular

import { firestore } from 'firebase/app';
import Timestamp = firestore.Timestamp;

@Injectable()
export class YourService {

....

    list = (): Observable<any[]> => this.collection
        .snapshotChanges()
        .pipe(
            map(changes => {
                return changes.map(a => {
                    const data = a.payload.doc.data() as any;
                    Object.keys(data).filter(key => data[key] instanceof Timestamp)
                        .forEach(key => data[key] = data[key].toDate())
                    data._id = a.payload.doc.id;
                    return data;
                });
            })
        );

...
}
Posted by: Guest on January-08-2021
0

firebase timestamp to date react

Add toDate();


created_at.toDate()
Posted by: Guest on December-15-2020

Code answers related to "firestore timestamp to date javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language