Skip to content

Commit

Permalink
Stupid datetimepicker. Make it look at our timezone for the Now button.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Cooper committed Aug 11, 2011
1 parent e5d28c0 commit 11d7094
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions railroad/static/js/functions.js
Expand Up @@ -67,6 +67,16 @@ Array.prototype.uniqueList = function() {
return uniqList;
}

// Fix the datetimepicker's now button to account for time zones.
$.datepicker._gotoToday = function(id) {
this._base_gotoToday(id);
var now = new Date();
if ($('#utc').prop('checked')) {
now.add({minutes: now.getTimezoneOffset()});
}
this._setTime(this._getInst($(id)[0]), now);
}

/******* FLOT HELPER FUNCTIONS *******/
$.plot.formatDate = function(d, fmt, monthNames) {
var leftPad = function(n) {
Expand Down Expand Up @@ -348,6 +358,7 @@ function makeDatetimePicker(elem, date, onClose) {
changeMonth: true,
changeYear: true,
});
datePicker.timezone = tz;
if (date) {
$(datePicker).datetimepicker('setDate', date)
}
Expand Down

0 comments on commit 11d7094

Please sign in to comment.