fleetmap-reports 1.0.667 → 1.0.668

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.667",
3
+ "version": "1.0.668",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/kms-report.js CHANGED
@@ -169,7 +169,9 @@ function processDevices (from, to, devices, data, userData) {
169
169
 
170
170
  if (trips.length > 0 && userData.groupByDay) {
171
171
  trips.forEach(t => {
172
- t.tripDay = convertFromUTC(t.startTime, userData.user.attributes.timezone).toISOString().split('T')[0] + ' 12:00 PM'
172
+ const tripDay = convertFromUTC(t.startTime, userData.user.attributes.timezone)
173
+ tripDay.setHours(12, 0, 0)
174
+ t.tripDay = tripDay.toISOString()
173
175
  })
174
176
  const groupedTrips = trips.reduce(
175
177
  (entryMap, e) => entryMap.set(e.tripDay, [...entryMap.get(e.tripDay) || [], e]),
@@ -181,7 +183,8 @@ function processDevices (from, to, devices, data, userData) {
181
183
  const days = []
182
184
  let keys = Array.from(groupedTrips.keys())
183
185
  allDates.forEach(d => {
184
- const day = d.toISOString().split('T')[0] + ' 12:00 PM'
186
+ d.setHours(12, 0, 0)
187
+ const day = d.toISOString()
185
188
  if (!keys.includes(day)) {
186
189
  groupedTrips.set(day, [])
187
190
  }
@@ -196,7 +199,6 @@ function processDevices (from, to, devices, data, userData) {
196
199
  date: currentDate,
197
200
  kms: 0
198
201
  }
199
-
200
202
  day.kms = dayTrips.reduce((a, b) => a + b.distance, 0)
201
203
 
202
204
  days.push(day)