时间戳变量存储在Firestore中,当提取时,它的格式为秒和纳秒,如何将时间戳转换为类似于2018-09-19T00:00:00的格式?
let Ref=firebase.firestore().collection("Recruiter").doc(u.uid).collection("Jobs")
Ref.orderBy("timestamp", "desc").onSnapshot(function(snapshot){
$.each(snapshot.docChanges(), function(){
var change= this
if(change.type==="added"){
var ab= new Date(change.doc.data().timestamp)
console.log(ab)
thisIns.RecruiterChart.chartOptions.xaxis.categories.push(
ab
)
console.log( thisIns.RecruiterChart.chartOptions.xaxis.categories)
}
})
})
变量ab在控制台上显示为"无效日期"