在客户端js SDK中,您可以执行以下操作:
import { firestore } from 'firebase/app';
const firestoreTimestamp = firestore.Timestamp.fromDate(new Date())
这是否可以使用firebase节点admin sdk?我尝试了以下方法:
import { firestore } from 'firebase-admin';
const firestoreTimestamp = firestore.Timestamp.fromDate(new Date())
但这会给出错误:
[ts] Property 'Timestamp' does not exist on type 'typeof firestore'.