fix(calendar(js)): swap start-end dates when delta is negative

When creating an event by drag'n'dropping from bottom to top, the
original coordinate become the start date.
This commit is contained in:
Francis Lachapelle
2019-10-30 13:55:03 -04:00
parent 060dea3818
commit 8b45f2c731
2 changed files with 11 additions and 1 deletions
@@ -759,6 +759,13 @@
* @param {number} delta - the number of minutes
*/
Component.prototype.setDelta = function(delta) {
if (delta < 0) {
var start = new Date(this.start.getTime());
start.setMinutes(Math.round(start.getMinutes()/15)*15);
start.addMinutes(delta);
this.start = start;
delta *= -1;
}
this.delta = delta;
this.end = new Date(this.start.getTime());
this.end.setMinutes(Math.round(this.end.getMinutes()/15)*15);