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 +1 -1
- package/src/kms-report.js +5 -3
package/package.json
CHANGED
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
|
-
|
|
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
|
-
|
|
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)
|