有谁知道计算一系列日期时间的平均时间的优雅方法?
到目前为止,我认为我可以转换为整数(例如秒)并计算平均值,然后转换回 Luxon 对象,但我担心这可能会带来一些错误?或者这仍然是最安全/最好的方法吗?
示例数据集:
var datez = [
{time: "Wed Jan 01 2020 00:00:00 GMT+0000 (Greenwich Mean Time)"},
{time: "Wed Jan 02 2020 21:10:00 GMT+0000 (Greenwich Mean Time)"},
{time: "Wed Jan 03 2020 11:34:00 GMT+0000 (Greenwich Mean Time)"},
{time: "Wed Jan 04 2020 22:50:00 GMT+0000 (Greenwich Mean Time)"},
{time: "Wed Jan 05 2020 12:12:00 GMT+0000 (Greenwich Mean Time)"}]