遇到TypeError错误:当我尝试使用具有持续时间的时刻时区时,moment.duration(...)。tz不是函数错误

时间:2018-09-09 13:21:15

标签: momentjs duration moment-timezone

嗨,我有以下问题。

我已经安装了moment-timezonemoment-duration库,并且如果尝试将其与时间格式结合,则始终处于紧迫的时区。

我的代码

import moment from 'moment-timezone'
import 'moment-duration-format'

 export function formatDate() {
 let duration = moment(date).diff(moment())
    duration = Math.max(duration, 60 * 1000)
    const format = duration > 60 * 59 * 1000 ? 'h': 'm'

  return moment
        .duration(duration, 'ms')
        .tz("EN")
        .format(format, { usePlural: false })
}

似乎我无法将时区与持续时间结合在一起,这没有任何意义  因为持续时间是应该可以格式化的时间。

任何想法可能会导致什么错误?

0 个答案:

没有答案
相关问题