mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-04 01:29:21 +00:00
Created filter to convert timezone offset to UTC
This commit is contained in:
parent
edb0b5e0af
commit
3f37da6f04
2 changed files with 19 additions and 0 deletions
18
website/public/js/filters/timezoneOffsetToUtc.js
Normal file
18
website/public/js/filters/timezoneOffsetToUtc.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
angular.module('habitrpg')
|
||||
.filter('timezoneOffsetToUtc', function () {
|
||||
return function (offset) {
|
||||
if (offset > 0) {
|
||||
var sign = '-';
|
||||
} else {
|
||||
var sign = '+';
|
||||
}
|
||||
|
||||
offset = Math.abs(offset) / 60;
|
||||
|
||||
var hour = Math.floor(offset);
|
||||
|
||||
var minutes = (offset - hour) * 60;
|
||||
|
||||
return 'UTC' + sign + hour + ':' + minutes;
|
||||
}
|
||||
});
|
||||
|
|
@ -57,6 +57,7 @@
|
|||
"js/filters/money.js",
|
||||
"js/filters/roundLargeNumbers.js",
|
||||
"js/filters/taskOrdering.js",
|
||||
"js/filters/timezoneOffsetToUtc.js",
|
||||
|
||||
"js/directives/close-menu.directive.js",
|
||||
"js/directives/expand-menu.directive.js",
|
||||
|
|
|
|||
Loading…
Reference in a new issue