Fix days difference in checkSelectionValid()
See original GitHub issueIn function checkSelectionValid()
(jquery.daterangepicker.js:1722) the days difference is counted as follows:
var days = Math.ceil((opt.end - opt.start) / 86400000) + 1;
which does not factor daylight saving time. Instead, it should be:
var days = countDays(opt.end, opt.start);
or using moment.js:
var days = moment(opt.end).diff(moment(opt.start), 'days');
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
Incorrect day range counting · Issue #310 · longbill/jquery-date ...
The number of days are being counted incorrectly in some cases. (See Images) ... Fix days difference in checkSelectionValid() #378.
Read more >Calculate the difference between two dates - Microsoft Support
How to calculate the number of days, months, or years between two dates using the DATEIF function in Excel.
Read more >Flutter: Find the number of days between two dates
You can use the difference method provide by DateTime class //the birthday's date final birthday = DateTime(1967, 10, 12); final date2 ...
Read more >Calculate the dates difference in days in Scoped Application
Solved: Hi All, we have a requirement to calculate the difference between two dates in days in scoped application.
Read more >Calculate the number of days between today and another date
So, the formula is: =TODAY() – B2. This, unfortunately, only gives you the number of days between today and the project start date....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, I refer to this line. I think it is a good idea to use moment.js for date diffing, since it it well tested.
Probably resolved with https://github.com/longbill/jquery-date-range-picker/pull/423, released in https://github.com/longbill/jquery-date-range-picker/releases/tag/0.16.2