Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
10 changes: 9 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,17 @@ <h2>
$(function() {

"use strict";

$(".gantt").gantt({
source: [{
name: "Daylight Saving Time",
desc: "Fix",
values: [{
from: "/Date(1349067600000)/",
to: "/Date(1353391200000)/",
label: "Daylight Saving Time",
customClass: "ganttOrange"
}]
},{
name: "Sprint 0",
desc: "Analysis",
values: [{
Expand Down
7 changes: 6 additions & 1 deletion js/jquery.fn.gantt.js
Original file line number Diff line number Diff line change
Expand Up @@ -1433,13 +1433,18 @@
}
return minDate;
},
daylightSavingAdjust: function(date){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably better to have it as is, than 'sort of' fixed. http://stackoverflow.com/questions/2532729/daylight-saving-time-and-timezone-best-practices touches on some of the things you need to think about. Adding 2 hours isn't really an appropriate fix - in all likelyhood it should probably be addressed in the date labelling code.

if (!date) return null;
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
return date;
},
parseDateRange: function (from, to) {
var current = new Date(from.getTime());
var end = new Date(to.getTime());
var ret = [];
var i = 0;
do {
ret[i++] = new Date(current.getTime());
ret[i++] = tools.daylightSavingAdjust(new Date(current.getTime()));
current.setDate(current.getDate() + 1);
} while (current.getTime() <= to.getTime());
return ret;
Expand Down