eduolalo / moment-business-days

This is a momentJS plugin that allows you to use only business days (Monday to Friday)
MIT License
240 stars 67 forks source link

Possible issue with toISOString in v.1.1.3 #72

Closed laxu closed 5 years ago

laxu commented 5 years ago

With moment-business-days 1.1.2 the following works as expected:

moment(date).businessAdd(1, 'days').toISOString();

The result is date + 1 day, e.g. 2019-01-03T12:00:00.000Z to 2019-01-04T12:00:00.000Z.

But with moment-business-days 1.1.3 I instead get 2019-01-03T22:00:00.000Z with the same date. So the time advances by +10 hours instead of the day.

mcdado commented 5 years ago

Hmm, can you provide more specifically what date is? If it has also time information or just date. That would be useful to setup a test case.

laxu commented 5 years ago

I used the value mentioned, so date in this case is string 2019-01-03T12:00:00.000Z.

mcdado commented 5 years ago

So, as it happens it was fixed in 6d2f1f502f4528912fd09caf895dc5f2a22588af which is the commit right after 1.1.3 release. The problem is that 1.1.4 hasn't been released yet. I'll bump it with @kalmecak

mcdado commented 5 years ago

I think until @kalmecak publishes a new version you can put kalmecak/moment-business-days in your package.json file: https://docs.npmjs.com/files/package.json#github-urls

This should pull in the latest version, but i don't know for sure.