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

export default function(duration, pattern = 'D天H小时m分') {
  if (!duration) return ''
  if (!moment.isDuration(duration)) duration = moment.duration(duration)
  return duration.format(pattern)
}
