aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r--web/app/AttributeFormatter.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index dcf50c580..1fff07bcf 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -39,6 +39,13 @@ Ext.define('Traccar.AttributeFormatter', {
return (hours + ' ' + Strings.sharedHourAbbreviation);
},
+ durationFormatter: function (value) {
+ var hours, minutes;
+ hours = Math.floor(value / 3600000);
+ minutes = Math.round((value % 3600000) / 60000);
+ return (hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation);
+ },
+
defaultFormatter: function (value) {
if (typeof value === 'number') {
return Number(value.toFixed(Traccar.Style.numberPrecision));
@@ -65,6 +72,8 @@ Ext.define('Traccar.AttributeFormatter', {
return this.distanceFormatter;
} else if (key === 'hours') {
return this.hoursFormatter;
+ } else if (key === 'duration') {
+ return this.durationFormatter;
} else {
return this.defaultFormatter;
}