You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package.json inside the 'backend' project points to dist/server.js. The file is located at dist/src/server.js. Not sure if the build is supposed to move the file to this location, or if your local configuration links this correctly, but it didn't in my case
When the tests ran, a single test case failed. It was saying there are 21 workdays in March 2020 instead of 22. I traced this to a Daylight Savings issue. The calculateWorkDaysBetween method increments the time by exactly 86400000 milliseconds on each iteration. I noticed that the primary author is perhaps based in China, which might explain this since their browser may not trigger the same DST logic based on their locale. Date manipulation in the browser is tricky overall, but one quick fix way around this would be if you're instantiating the Date object using the new Date(year, monthIndex, day, hours, minutes, seconds) convention. This way, if you simply want to iterate day-by-day over an arbitrary date-range, you can just increment the 'days' parameter.
ie. new Date(2020,2,70,0,0,0) == Sat May 09 2020 00:00:00
I saw what appeared to be the same issue under Deployment Frequency result is not accurate. #10 . After a quick review of that I thought it might also be tied to the Daylight Savings issue.. In November, DST removes an hour as opposed to March, where an hour is added. This would cause an extra day, instead of the loss of a day in the calculation. Then I realized the Daylight Savings bug alone wouldn't explain why the date-range appears to have increased by 2 work days instead of 1. Instead this appears to be a combination of 2 separate issues. The Daylight Savings bug plus what appears to be a mistake in the 2020.json file. Granted, the holidays list isn't relevant to US, the following JSON entry appears to be adding an extra "day" into the calculation of the total number of work days in Oct 2020. By my calculation if you account for all the holidays from the json file, the total number of work days would be 16, but because of this extra entry, the method provides a result of 17. This is evident by the unit test which is looking for 2020-10-01 to 2020-10-31 to calculate a total of 17 work days in this date-range.
I did confirm that when "isOffDay" is false, the logic of the method does add an extra day into the returned result. I stopped testing at this point. The evidence appears sufficient to point to this combination of issues as causing the problem reported in #10 .
The text was updated successfully, but these errors were encountered:
package.json inside the 'backend' project points to
dist/server.js
. The file is located atdist/src/server.js
. Not sure if the build is supposed to move the file to this location, or if your local configuration links this correctly, but it didn't in my caseWhen the tests ran, a single test case failed. It was saying there are 21 workdays in March 2020 instead of 22. I traced this to a Daylight Savings issue. The
calculateWorkDaysBetween
method increments the time by exactly 86400000 milliseconds on each iteration. I noticed that the primary author is perhaps based in China, which might explain this since their browser may not trigger the same DST logic based on their locale. Date manipulation in the browser is tricky overall, but one quick fix way around this would be if you're instantiating the Date object using thenew Date(year, monthIndex, day, hours, minutes, seconds)
convention. This way, if you simply want to iterate day-by-day over an arbitrary date-range, you can just increment the 'days' parameter.ie.
new Date(2020,2,70,0,0,0) == Sat May 09 2020 00:00:00
I saw what appeared to be the same issue under Deployment Frequency result is not accurate. #10 . After a quick review of that I thought it might also be tied to the Daylight Savings issue.. In November, DST removes an hour as opposed to March, where an hour is added. This would cause an extra day, instead of the loss of a day in the calculation. Then I realized the Daylight Savings bug alone wouldn't explain why the date-range appears to have increased by 2 work days instead of 1. Instead this appears to be a combination of 2 separate issues. The Daylight Savings bug plus what appears to be a mistake in the 2020.json file. Granted, the holidays list isn't relevant to US, the following JSON entry appears to be adding an extra "day" into the calculation of the total number of work days in Oct 2020. By my calculation if you account for all the holidays from the json file, the total number of work days would be 16, but because of this extra entry, the method provides a result of 17. This is evident by the unit test which is looking for 2020-10-01 to 2020-10-31 to calculate a total of 17 work days in this date-range.
I did confirm that when "isOffDay" is false, the logic of the method does add an extra day into the returned result. I stopped testing at this point. The evidence appears sufficient to point to this combination of issues as causing the problem reported in #10 .
The text was updated successfully, but these errors were encountered: