Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subtractWorkingTime throws Error #46

Open
rejeevd opened this issue Dec 28, 2020 · 1 comment
Open

subtractWorkingTime throws Error #46

rejeevd opened this issue Dec 28, 2020 · 1 comment

Comments

@rejeevd
Copy link

rejeevd commented Dec 28, 2020

subtractWorkingTime from a nonworking time throws an error.
Please see the below code.

const moment = require("moment-business-time");
moment.locale("en", {
  workinghours: {
    0: null,
    1: ["00:00:00", "24:00:00"],
    2: ["00:00:00", "24:00:00"],
    3: ["00:00:00", "24:00:00"],
    4: ["00:00:00", "24:00:00"],
    5: ["00:00:00", "24:00:00"],
    6: null,
  },
  holidays: [],
});

var endDate = moment.utc("2020-12-26T15:00:00Z").add(3, "hours");
var startDate = endDate.subtractWorkingTime(1, "week");
console.log(startDate.format());

Please use the below link to run the code
https://repl.it/@RejeevDivakaran/OpaqueUnfinishedModem#index.js

@lennym
Copy link
Owner

lennym commented Dec 29, 2020

The REPL you have linked does not throw an error and works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants