Skip to content

Instantly share code, notes, and snippets.

@hmmhmmhm
Last active June 1, 2020 05:17
Show Gist options
  • Save hmmhmmhm/622b1a7600fe1898ec2644bfecf78e4d to your computer and use it in GitHub Desktop.
Save hmmhmmhm/622b1a7600fe1898ec2644bfecf78e4d to your computer and use it in GitHub Desktop.
모멘트를 통한시간 값 비교 시 format 적용방법
import moment from 'moment'
import 'moment-duration-format'
let currentMoment = moment()
let currentMinuteNum = Number(currentMoment.format('mm'))
let nextMin = 1
let _nextContractTime = moment(currentMoment)
.add(nextMin, 'minute')
.set('second', 0)
let _remainTimeSecond = _nextContractTime.diff(
currentMoment,
'milisecond'
)
let remainTime = moment.duration(_remainTimeSecond).format('mm:ss')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment