mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-06-05 02:19:43 +00:00
Fix all-day events covering a timezone change
This commit is contained in:
@@ -422,13 +422,10 @@
|
||||
|
||||
if (this.endDate) {
|
||||
this.end = new Date(this.endDate.substring(0,10) + ' ' + this.endDate.substring(11,16));
|
||||
this.delta = Math.floor((Math.abs(this.end - this.start)/1000)/60);
|
||||
this.delta = this.start.minutesTo(this.end);
|
||||
}
|
||||
else if (this.type == 'appointment') {
|
||||
this.end = new Date(this.start.getTime());
|
||||
this.end.setMinutes(Math.round(this.end.getMinutes()/15)*15);
|
||||
this.end.addMinutes(this.delta);
|
||||
//this.end.addMinutes(this.delta);
|
||||
this.setDelta(this.delta);
|
||||
}
|
||||
|
||||
if (this.dueDate)
|
||||
@@ -650,6 +647,19 @@
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @function setDelta
|
||||
* @memberof Component.prototype
|
||||
* @desc Set the end time to the specified number of minutes after the start time.
|
||||
* @param {number} delta - the number of minutes
|
||||
*/
|
||||
Component.prototype.setDelta = function(delta) {
|
||||
this.delta = delta;
|
||||
this.end = new Date(this.start.getTime());
|
||||
this.end.setMinutes(Math.round(this.end.getMinutes()/15)*15);
|
||||
this.end.addMinutes(this.delta);
|
||||
};
|
||||
|
||||
/**
|
||||
* @function updateFreeBusy
|
||||
* @memberof Component.prototype
|
||||
|
||||
@@ -299,11 +299,11 @@
|
||||
|
||||
function adjustEndTime() {
|
||||
// The end date must be after the start date
|
||||
var delta = vm.component.end.valueOf() - vm.component.start.valueOf();
|
||||
var delta = vm.component.start.minutesTo(vm.component.end);
|
||||
if (delta < 0)
|
||||
vm.component.end = new Date(oldEndDate.getTime());
|
||||
else {
|
||||
vm.component.delta = Math.floor((Math.abs(vm.component.end - vm.component.start)/1000)/60);
|
||||
vm.component.delta = delta;
|
||||
oldEndDate = new Date(vm.component.end.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user