typescript - Cloud Firestore 中的日期和时间格式
问题描述
我将 Flutter 用于我的移动应用程序。它以这种格式将日期存储在云 Firestore 中。
February 14, 2020 at 12:00:00 AM UTC+5
但是当我从 Cloud Functions 保存日期时,它会存储为 Map
{
_nanoseconds: 0,
_seconds: 1582743600
}
我希望云函数根据 Flutter 的格式存储日期。
我怎样才能做到这一点?
解决方案
它将其存储为firebase.firestore.Timestamp
( doc )。
Timestamp
您可以使用导入
import { Timestamp } from "@google-cloud/firestore";
推荐阅读
- php - 如何重新创建套接字文件?
- powershell - 在 PowerShell 中使用 YQ 时出现引用问题
- python - 如何使 pandas 的 read_excel 参数“nrows”动态化
- javascript - MongoError: Topology is closed, please connect - 使用 Jest 运行单元测试时
- python - 当源代码没有改变,但是 selenium webdriver deos 没有返回元素时
- javascript - 基于 2 个数组创建对象数组
- python - PYTHON - 错误:device_event_log_impl.cc(214)] [17:43:52.278] USB:usb_device_handle_win.cc:1056 无法从节点连接读取描述符
- python - Flask 忽略的离线引导程序
- flutter - 为什么我会出现堆栈溢出?
- javascript - 为什么 forEach 适用于 nodeList 但不适用于集合