【发布时间】:2020-01-14 04:37:27
【问题描述】:
我正在尝试将数据从函数存储到 Firestore,但日期有问题。 我的功能:
const newScheduleEventRef = db.collection('scheduleEvents').doc();
batch.set(newScheduleEventRef, {
user_id: context.auth.uid,
category: 1,
startDate1: new Date(year, month, day, 0, 0, 0),
startDate2: new Date(year, month, day, 0, 0, 0),
endDate1: new Date(year, month, day, 23, 59, 59),
endDate2: new Date(year, month,day, 23, 59, 59),
eventAlias: entry,
addDate: new Date()
});
这是我得到的:
这可能是由于TimeZone,但我不知道如何解决它。
谢谢。
【问题讨论】:
标签: javascript date google-cloud-firestore google-cloud-functions