Last active
June 1, 2020 05:17
-
-
Save hmmhmmhm/622b1a7600fe1898ec2644bfecf78e4d to your computer and use it in GitHub Desktop.
모멘트를 통한시간 값 비교 시 format 적용방법
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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