longbill / jquery-date-range-picker

A jQuery plugin that allows user to select a date range
MIT License
1.12k stars 578 forks source link

Wrong days interval when choose period with DST days. +/- 1 day! #326

Open Segerega opened 7 years ago

Segerega commented 7 years ago

When I choose period in Spring or Autumn including DST days ( 23 Hours on Spring and 25 on Autumn). This way we have wrong days count. I fixed it by changing Math.round function to ceil. It's working well in CET zone, maybe it might need some adjustments for other time zones. jquery.daterangepicker.js:1736 function checkSelectionValid() { var days = Math.ceil( (opt.end - opt.start) / 86400000 ) + 1;

holtkamp commented 7 years ago

@Segerega can you come up with an example of the problem on https://jsfiddle.net and maybe a PR with your solution?