Pushing datetime value to firebase database with moment.js



I have a problem with ionic datetime. If i try to push the datetime value to my firebase database i see the following there: 2017-10-12T16:23:00Z

I am trying to format this to a more user friendly date with moment.js but i can’t really format it before pushing it to my database:


<ion-datetime displayFormat="YYYY-MM-DD HH:mm" pickerFormat="YYYY-MM-DDTHH:mm" [(ngModel)]="fogasDatuma"></ion-datetime>




export class FogasfeltoltesPage {



My guess is that Firebase would be smart and convert it to a more computer friendly format for storing in the actual database.

So you have two options, at least insofar as my extremely limited Firebase knowledge goes, either change Firebase to store it as a string (…assuming that Firebase has types) or convert it when you get it from the back-end.

The problem with the latter of course is it restricts you if you need to do any fancy logic based on date.

And again, I don’t have much experience with Firebase.