In Moment.js, how do you get the current financial Quarter?

后端 未结 9 1714
深忆病人
深忆病人 2020-12-14 16:07

Is there a simple/built in way of figuring out the current financial quarter?

ex:

  • Jan-Mar: 1st
  • Apr-Jul: 2nd
  • Jul-Sept: 3rd
9条回答
  •  轮回少年
    2020-12-14 16:51

    This is now supported in moment:

    moment('2014-12-01').utc().quarter() //outputs 4
    moment().quarter(); //outputs current quarter ie. 2
    

    Documentation

提交回复
热议问题