首页 > 解决方案 > 如何使用 Moment JS 查找本月剩余的工作日数

问题描述

嘿伙计们,我正在尝试查找本月的工作日数。

使用moment-business-days我可以计算出两个日期之间有多少个工作日。我也可以算出这周还有多少工作日。但是我很困惑如何找到本月还剩多少工作日。

const diffDays = moment(secondDate).businessDiff(
  moment(firstDate),
  "days",
  true
); // this is where I find how many business days in between two dates

// and here how many business days left this week
const daysLeftThisWeek = 6 - moment(firstDate).day();

标签: javascriptmomentjs

解决方案


推荐阅读