[Vuejs]-Date was reflected in the code but it is not showing in database

0👍

this is because firestore use is own date format. Or you can try to use:

new Date().getTime()

But I suggest you to use the firestore Timestamp

0👍

the new Date()constructor doesn’t return a string in your case

you can do it this way :

mounted(){
 var date = new Date();
 database.once('value', pages =>{
  pages.forEach(page => {
    this.pages.push({
     ...
     datetime : date.toJSON();
    })
   }
 }
}

Leave a comment