How to calculate Number of 'Working days' between two dates in Javascript using moment.js?

前端 未结 7 2051
我寻月下人不归
我寻月下人不归 2020-12-31 05:21

How to calculate the number of working days between two dates in JavaScript using moment.js. I have a working formula that calculate these days, but the formula does not sat

7条回答
  •  暖寄归人
    2020-12-31 05:51

    I have been used a useful library moment-business-days coupled with moment

    NPM Link of Moment-business-days

    NPM Link of Moment

    Sample of how many business days between

    const diff = moment('05-15-2017', 'MM-DD-YYYY').businessDiff(moment('05-08-2017','MM-DD-YYYY'));
    // diff = 5
    

提交回复
热议问题