fleetmap-reports 1.0.467 → 1.0.469

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/util/utils.js +10 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetmap-reports",
3
- "version": "1.0.467",
3
+ "version": "1.0.469",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/util/utils.js CHANGED
@@ -32,7 +32,7 @@ function coordsDistance (lon1, lat1, lon2, lat2) {
32
32
  const from = turf.point([lon1, lat1])
33
33
  const to = turf.point([lon2, lat2])
34
34
 
35
- return distance.default(from, to, {units: 'meters'})
35
+ return distance.default(from, to, { units: 'meters' })
36
36
  }
37
37
 
38
38
  function convertPositionToFeature (position) {
@@ -54,9 +54,9 @@ function convertToFeature (geofence) {
54
54
  }
55
55
  }
56
56
  const str = geofence.area.substring('POLYGON(('.length, geofence.area.length - 2)
57
- const coord_list = str.split(',')
58
- for (const i in coord_list) {
59
- const coord = coord_list[i].trim().split(' ')
57
+ const coordList = str.split(',')
58
+ for (const i in coordList) {
59
+ const coord = coordList[i].trim().split(' ')
60
60
  feature.geometry.coordinates[0].push([parseFloat(coord[1]), parseFloat(coord[0])])
61
61
  }
62
62
  return feature
@@ -64,19 +64,19 @@ function convertToFeature (geofence) {
64
64
 
65
65
  if (geofence.area.startsWith('CIRCLE')) {
66
66
  const str = geofence.area.substring('CIRCLE ('.length, geofence.area.length - 1)
67
- const coord_list = str.split(',')
68
- const coord = coord_list[0].trim().split(' ')
67
+ const coordList = str.split(',')
68
+ const coord = coordList[0].trim().split(' ')
69
69
  const point = turf.point([parseFloat(coord[1]), parseFloat(coord[0])])
70
70
  point.properties.geofence = geofence
71
- point.properties.distance = coord_list[1].trim()
71
+ point.properties.distance = coordList[1].trim()
72
72
  console.log(point)
73
73
  return point
74
74
  }
75
75
 
76
76
  if (geofence.area.startsWith('LINESTRING')) {
77
77
  const str = geofence.area.substring('LINESTRING ('.length, geofence.area.length - 1)
78
- const coord_list = str.split(',')
79
- const coordinates = coord_list.map(c => {
78
+ const coordList = str.split(',')
79
+ const coordinates = coordList.map(c => {
80
80
  const coord = c.trim().split(' ')
81
81
  return [parseFloat(coord[1]), parseFloat(coord[0])]
82
82
  })
@@ -95,7 +95,7 @@ function convertToFeature (geofence) {
95
95
 
96
96
  function getDates (startDate, endDate) {
97
97
  const dates = []
98
- let currentDate = new Date(startDate.toISOString().split('T')[0] + ' 12:00:00.000 PM')
98
+ let currentDate = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(), 12, 0, 0, 0)
99
99
  const addDays = function (days) {
100
100
  const date = new Date(this.valueOf())
101
101
  date.setDate(date.getDate() + days)