Skip to content

Commit

Permalink
Merge branch 'fix-cal-heatmap' of https://github.com/terakilobyte/fre…
Browse files Browse the repository at this point in the history
…ecodecamp into terakilobyte-fix-cal-heatmap
  • Loading branch information
Berkeley Martinez authored and Berkeley Martinez committed Nov 10, 2015
2 parents a0573d2 + 969204e commit 7d43dda
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion server/views/account/show.jade
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,27 @@ block content
#cal-heatmap.d3-centered
script.
$(document).ready(function () {
var estUTCOffset = -5;
// moment returns the utc offset in minutes
var userUTCOffset = moment().utcOffset() / 60;
var secondsToOffset =
(estUTCOffset - userUTCOffset) * 3600;
var cal = new CalHeatMap();
var calendar = !{JSON.stringify(calender)};
var offsetCalendar = {};
for (var prop in calendar) {
if (calendar.hasOwnProperty(prop)) {
var offsetProp = +prop + secondsToOffset;
offsetCalendar[offsetProp] =
calendar[prop];
}
}
cal.init({
itemSelector: "#cal-heatmap",
domain: "month",
subDomain: "x_day",
domainGutter: 10,
data: calendar,
data: offsetCalendar,
cellSize: 15,
align: 'center',
cellRadius: 3,
Expand Down

0 comments on commit 7d43dda

Please sign in to comment.