Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 474182c

Browse files
Unable to update document using serverTimeStamp #805
1 parent 3c14bdc commit 474182c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

demo-ng/app/tabs/firestore/firestore.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ export class FirestoreComponent {
122122
.update({
123123
name: "Woofieupdate",
124124
last: "updatedwoofie!",
125-
updateTs: firebase.firestore().FieldValue().serverTimestamp(),
125+
updateTs: firestore.FieldValue.serverTimestamp(),
126+
updateTsAlt: firebase.firestore().FieldValue().serverTimestamp(),
126127
lastKnownLocation: firebase.firestore().GeoPoint(4.34, 5.67)
127128
})
128129
.then(() => console.log("Woofie updated"))

src/firebase-common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export const firebase: any = {
2626
storage,
2727
mlkit,
2828
firestore: {
29-
FieldValue,
29+
FieldValue: {
30+
serverTimestamp: () => "SERVER_TIMESTAMP"
31+
},
3032
GeoPoint: (latitude: number, longitude: number) => new GeoPoint(latitude, longitude)
3133
},
3234
invites: {

0 commit comments

Comments
 (0)