Mat*_*art 2 date node.js firebase google-cloud-firestore
我似乎无法在 Web/Javascript 文档中的任何地方找到有关将日期保存到 Firestore 的任何内容。在 中Swift,我使用创建了一个变量NSDate,然后 Firebase 能够将它作为日期对象存储在数据库中。Node.js 中是否有类似的功能?我可以使用date-and-time包还是在 Node.js 中对日期有本机支持?
Run Code Online (Sandbox Code Playgroud)var docData = { stringExample: "Hello world!", booleanExample: true, numberExample: 3.14159265, dateExample: admin.firestore.Timestamp.fromDate(new Date("December 10, 1815")), arrayExample: [5, true, "hello"], nullExample: null, objectExample: { a: 5, b: { nested: "foo" } } }; db.collection("data").doc("one").set(docData).then(function() { console.log("Document successfully written!"); });
| 归档时间: |
|
| 查看次数: |
3834 次 |
| 最近记录: |