Bad*_*dgy 4 javascript node.js firebase google-cloud-firestore
以下片段
const start = new Date(this.date + 'T' + this.time);
console.log(start); // Thu Sep 12 2019 04:00:00 GMT+0200
const tournament:Tournament = {
start: firebase.firestore.Timestamp.fromDate(start)
}
Run Code Online (Sandbox Code Playgroud)
将此锦标赛对象传递给可调用云函数(其唯一目的是将tournament传递的数据保存为文档)会将start字段保存为具有属性的地图seconds,而miliseconds不是 Firestore 中的时间戳。
我也尝试这样做start: start,但这也没有带来在 Firestore 中保存时间戳的预期结果。
仅供参考,这是功能代码精简后的样子:
firestore.collection('tournaments').doc(slugUrl).set(tournamentData)
(tournamentData是前端传入的Object)
| 归档时间: |
|
| 查看次数: |
1635 次 |
| 最近记录: |