Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: use correct date when converting to UTC to get correct timezone. #401

Merged
merged 1 commit into from
Apr 2, 2015
Merged
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
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