capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.
https://capawesome.io/plugins/firebase/
Apache License 2.0
392 stars 101 forks source link

How to save date in Angular as a timestamp to Firestore #564

Closed SureshKumarToverto closed 8 months ago

SureshKumarToverto commented 8 months ago

Plugin(s)

Version

5.4.0

Platform(s)

Current behavior

createdOn= new Date(); // gives such result in firestore with string type // createdOn: "2018-11-16T09:48:51.137Z"

image

Expected behavior

what is the best way to save date as a timestamp createdOn

image

Reproduction

https://github.com/capawesome-team/capacitor-firebase/tree/main/packages/firestore

Steps to reproduce

import { FirebaseFirestore } from '@capacitor-firebase/firestore'; this.logDataGlobal.createdOn = Date.now(); this.logDataGlobal.uuid = deviceId.identifier; this.logDataGlobal.username = localStorage.getItem('username'); this.logDataGlobal.activestatus = true;

addFirebase(logDatas): void { FirebaseFirestore.addDocument({ reference: 'mlogs', data: logDatas, }); }

Other information

No response

Capacitor doctor

ionic cap build android

Before submitting

robingenz commented 8 months ago

This is currently a bug in Capacitor (see https://github.com/ionic-team/capacitor/issues/7252). I close this as duplicate of #474.