如何获取Firestore时间戳之间的持续时间?
问题描述:
我正在使用Node.js Firebase云功能,并且每个都有2个带有Firestore时间戳对象的文档.
I am use Node.js Firebase cloud function and have 2 document each with Firestore timestamp object.
如何获取以分钟为单位的时间戳之间的持续时间?例如137分钟.
How to get duration between timestamp in minute? For example 137 minute.
答
Timestamp
具有有用的属性:seconds
.
因此,您可以编写:
(t1.seconds - t2.seconds) / 60