round up/ round down a momentjs moment to nearest minute

后端 未结 10 1450
一整个雨季
一整个雨季 2020-12-05 01:47

How do you round up/ round down a momentjs moment to nearest minute?

I have checked the docs, but there doesn\'t appear to be a method for this.

Note that I

10条回答
  •  暖寄归人
    2020-12-05 01:59

    Partial answer:

    To round down to nearest moment minute:

    var m = moment();
    m.startOf('minute');
    

    However, the equivalent for rounding up, endOf, doesn't quite give the expected result.

提交回复
热议问题