(js) Handle DST change in Date.daysUpTo

pull/259/head
Francis Lachapelle 2019-10-04 09:54:29 -04:00
parent 349be8b4db
commit 10b5eb736f
3 changed files with 18 additions and 16 deletions

1
NEWS
View File

@ -25,6 +25,7 @@ Bug fixes
- [web] don't mark draft as deleted when SOGoMailKeepDraftsAfterSend is enabled (#4830)
- [web] allow single-day vacation auto-reply (#4698)
- [web] allow import to calendar subscriptions with creation rights
- [web] handle DST change in Date.daysUpTo
- [core] honor IMAPLoginFieldName also when setting IMAP ACLs
- [core] honor groups when setting IMAP ACLs
- [core] honor "any authenticated user" when setting IMAP ACLs

View File

@ -269,24 +269,25 @@ Date.prototype.clone = function() {
};
Date.prototype.daysUpTo = function(otherDate) {
var days = [];
var days = [];
var day1 = this.getTime();
var day2 = otherDate.getTime();
if (day1 > day2) {
var tmp = day1;
day1 = day2;
day2 = tmp;
}
var day1 = this.getTime();
var day2 = otherDate.getTime();
if (day1 > day2) {
var tmp = day1;
day1 = day2;
day2 = tmp;
}
var nbrDays = Math.round((day2 - day1) / 86400000) + 1;
for (var i = 0; i < nbrDays; i++) {
var newDate = new Date();
newDate.setTime(day1 + (i * 86400000));
days.push(newDate);
}
var DAY_SECS = 25 * 60 * 60 * 1000; // compensate for DST
var nbrDays = Math.round((day2 - day1) / DAY_SECS) + 1;
for (var i = 0; i < nbrDays; i++) {
var newDate = new Date();
newDate.setTime(day1 + (i * 86400000));
days.push(newDate);
}
return days;
return days;
};
Date.prototype.minutesTo = function(otherDate) {

View File

@ -534,7 +534,7 @@
function updateFreeBusy() {
vm.component.$attendees.updateFreeBusyCoverage();
vm.component.$attendees.updateFreeBusy();
scrollToStart();
$timeout(scrollToStart);
}
}