diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-08-20 13:13:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-20 13:13:09 +0300 |
commit | 6c6b62351aadd68928b9bd3e39e2bf96d78695e8 (patch) | |
tree | 8d9f5617aada94e3c8784c0bee6a201fbced54b3 /web/app/AttributeFormatter.js | |
parent | 6b6d28695600fee509ee37a7225dd6518879ac9c (diff) | |
parent | 804c56a76dc8406e4ff072289a4a9f97322dfe83 (diff) | |
download | trackermap-server-6c6b62351aadd68928b9bd3e39e2bf96d78695e8.tar.gz trackermap-server-6c6b62351aadd68928b9bd3e39e2bf96d78695e8.tar.bz2 trackermap-server-6c6b62351aadd68928b9bd3e39e2bf96d78695e8.zip |
Merge pull request #2228 from Abyss777/reports_trips
Implement trips reports
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r-- | web/app/AttributeFormatter.js | 9 |
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; } |