mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-08 23:19:04 +01:00
Fix yearly planner
- months were 1 day too short when computer timezone was east of GMT - slight mismatch between positions between months - hover time was off by just a bit
This commit is contained in:
parent
035ef0a9c7
commit
78a1768bc4
@ -504,11 +504,16 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
|||||||
draw_row: function(sort_key, label, events)
|
draw_row: function(sort_key, label, events)
|
||||||
{
|
{
|
||||||
var key = sort_key.split('-');
|
var key = sort_key.split('-');
|
||||||
this._drawRow(
|
var start = new Date(key[0]+"-"+sprintf("%02d",parseInt(key[1])+1)+"-01T00:00:00Z");
|
||||||
sort_key, label, events,
|
// Use some care to avoid issues with timezones and daylight savings
|
||||||
new Date(key[0]+"-"+sprintf("%02d",parseInt(key[1])+1)+"-01T00:00:00Z"),
|
var end = new Date(start);
|
||||||
new Date(key[0],parseInt(key[1])+1,0)
|
end.setUTCMonth(start.getUTCMonth() + 1);
|
||||||
);
|
end.setUTCDate(1);
|
||||||
|
end.setUTCHours(0);
|
||||||
|
end.setUTCMinutes(0);
|
||||||
|
end = new Date(end.valueOf() - 1000);
|
||||||
|
end.setUTCMonth(start.getUTCMonth())
|
||||||
|
this._drawRow(sort_key, label, events, start, end);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Group by category has one row for each [sub]category
|
// Group by category has one row for each [sub]category
|
||||||
@ -1820,7 +1825,10 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
|||||||
x = Math.round(x);
|
x = Math.round(x);
|
||||||
y = Math.round(y);
|
y = Math.round(y);
|
||||||
|
|
||||||
|
// Relative horizontal position, as a percentage
|
||||||
var rel_x = Math.min(x / jQuery('.calendar_eventRows',this.div).width(),1);
|
var rel_x = Math.min(x / jQuery('.calendar_eventRows',this.div).width(),1);
|
||||||
|
|
||||||
|
// Relative time, in minutes from start
|
||||||
var rel_time = 0;
|
var rel_time = 0;
|
||||||
|
|
||||||
// Simple math, the x is offset from start date
|
// Simple math, the x is offset from start date
|
||||||
@ -1844,8 +1852,12 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
|||||||
}
|
}
|
||||||
if(row_widget)
|
if(row_widget)
|
||||||
{
|
{
|
||||||
rel_x = Math.min((x-row_widget.rows.offset().left)/row_widget.rows.width(),1);
|
// Not sure where the extra -1 and +2 are coming from, but it makes it work out
|
||||||
rel_time = (new Date(row_widget.options.end_date) - new Date(row_widget.options.start_date))*rel_x/1000;
|
// in FF & Chrome
|
||||||
|
rel_x = Math.min((x-row_widget.rows.offset().left-1)/(row_widget.rows.width()+2),1);
|
||||||
|
|
||||||
|
// 2678400 is the number of seconds in 31 days
|
||||||
|
rel_time = (2678400)*rel_x;
|
||||||
this.date_helper.set_value(row_widget.options.start_date.toJSON());
|
this.date_helper.set_value(row_widget.options.start_date.toJSON());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -107,7 +107,7 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
|
|||||||
var width = 100;
|
var width = 100;
|
||||||
if (this._parent.options.group_by === 'month')
|
if (this._parent.options.group_by === 'month')
|
||||||
{
|
{
|
||||||
days = new Date(this.options.end_date.getUTCFullYear(),this.options.end_date.getUTCMonth()+1,0).getUTCDate();
|
days = this.options.end_date.getUTCDate();
|
||||||
|
|
||||||
if(days < 31)
|
if(days < 31)
|
||||||
{
|
{
|
||||||
@ -480,7 +480,7 @@ var et2_calendar_planner_row = (function(){ "use strict"; return et2_valueWidget
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 2678400 is the number of seconds in 31 days
|
// 2678400 is the number of seconds in 31 days
|
||||||
//pos = (t - start) / 2678400000;
|
pos = (t - start) / 2678400000;
|
||||||
}
|
}
|
||||||
pos = 100 * pos;
|
pos = 100 * pos;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user