Skip to content

Commit

Permalink
Merge pull request #401 from EverythingMe/fix/wrong_time_zone
Browse files Browse the repository at this point in the history
Fix: use correct date when converting to UTC to get correct timezone.
  • Loading branch information
arikfr committed Apr 2, 2015
2 parents e80e52f + aeff3f1 commit 267c32b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rd_ui/app/scripts/directives/query_directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
}

$scope.updateSchedule = function() {
var newSchedule = moment($scope.hour + ":" + $scope.minute, 'HH:mm').utc().format('HH:mm');
var newSchedule = moment().hour($scope.hour).minute($scope.minute).utc().format('HH:mm');
if (newSchedule != $scope.query.schedule) {
$scope.query.schedule = newSchedule;
$scope.saveQuery();
Expand Down
3 changes: 2 additions & 1 deletion rd_ui/app/scripts/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ angular.module('redash.filters', []).
if (schedule === null) {
return "Never";
} else if (schedule.match(/\d\d:\d\d/) !== null) {
var localTime = moment.utc(schedule, 'HH:mm').local().format('HH:mm');
var parts = schedule.split(':');
var localTime = moment.utc().hour(parts[0]).minute(parts[1]).local().format('HH:mm');
return "Every day at " + localTime;
}

Expand Down
3 changes: 2 additions & 1 deletion rd_ui/app/scripts/services/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@
}

Query.prototype.scheduleInLocalTime = function() {
return moment.utc(this.schedule, 'HH:mm').local().format('HH:mm');
var parts = this.schedule.split(':');
return moment.utc().hour(parts[0]).minute(parts[1]).local().format('HH:mm');
}

Query.prototype.getQueryResult = function (maxAge, parameters) {
Expand Down

0 comments on commit 267c32b

Please sign in to comment.