capawesome-team / capacitor-firebase

⚡️ Firebase plugins for Capacitor. Supports Android, iOS and the Web.

Home Page:https://capawesome.io/plugins/firebase/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to save date in Angular as a timestamp to Firestore

SureshKumarToverto opened this issue · comments

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Version

5.4.0

Platform(s)

  • Android
  • iOS
  • Web

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

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.

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