我有以下代码:
//function fires
createNewEvent = () => {
if(Boolean(this.state.newEventName)){
console.log(this.indexToDay) //logs right value of date
newEvent(
this.state.newEventName,
this.indexToDay,
this.pxToTime(this.state.initial.top),
this.pxToTime(this.state.initial.bot)
)
}
}
//firebase.js
export const newEvent = (name, date, top, bot) => {
console.log(date) //logs right value of date
const newEventRef = eventsRef.push();
newEventRef.set({
name,
date,
top,
bot,
})
}
日志中的日期如下所示:Sat Jul 07 2018 16:40:00 GMT+0200
但在 firebase 中,只显示名称、top 和 bot。
为什么?
最佳答案
尝试转换成字符串或者时间戳。
var d = new Date()+"";
关于javascript - Firebase 不存储日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51223244/