fleetmap-reports 1.0.239 → 1.0.243

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.239",
3
+ "version": "1.0.243",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/kms-report.js CHANGED
@@ -49,7 +49,7 @@ function processDevices(from, to, devices, data) {
49
49
  const locations = data.filter(t => t.deviceId === d.id)
50
50
 
51
51
  if (locations.length > 0) {
52
- locations.forEach(l => l.locationDate = l.fixTime.substring(0, 10) + ' 12:00 PM')
52
+ locations.forEach(l => l.locationDate = new Date(l.fixTime).toISOString().split('T')[0] + ' 12:00 PM')
53
53
  const groupedLocations = locations.reduce(
54
54
  (entryMap, e) => entryMap.set(e.locationDate, [...entryMap.get(e.locationDate)||[], e]),
55
55
  new Map()
@@ -61,7 +61,7 @@ function processDevices(from, to, devices, data) {
61
61
  keys.forEach(key => {
62
62
  const dayLocations = groupedLocations.get(key)
63
63
  const day = {
64
- date: new Date(key).toLocaleDateString(),
64
+ date: new Date(key),
65
65
  kms: dayLocations.reduce((a, b) => a + b.attributes.distance, 0) || 0
66
66
  }
67
67
  days.push(day)
@@ -104,7 +104,7 @@ async function createKmsReport(from, to, userData, traccar) {
104
104
  }
105
105
 
106
106
  async function exportKmsReportToPDF(userData, reportData) {
107
- const lang = userData.user.attributes.lang
107
+ const lang = userData.user.attributes.lang || (navigator && navigator.language)
108
108
  const translations = messages[lang] ? messages[lang] : messages['en-GB']
109
109
  const kmsData = userData.byDriver ? reportData.drivers : reportData.devices
110
110