traccar / traccar-web

Traccar GPS Tracking System
https://www.traccar.org
Apache License 2.0
789 stars 1.09k forks source link

Custom date on Reports #1138

Closed cfilomena closed 1 year ago

cfilomena commented 1 year ago

Hello, In the Reports section of web interface (I tried Events, Trips) when I select a device and then a custom always appears this error

HOUR_OF_DAY: 2 -> 3 - IllegalArgumentException (... < QueryBuilder:368 < *:446 < DatabaseStorage:76 < EventsReportProvider:66 < ...)

I've checked with inspector and the problem is that the api call failed with error 400

image

with "standard" filters, for example, Yesterday , This Month etc the problem does not occur

Traccar (on docker) version 5.8 both app and web

Thanks

tananaev commented 1 year ago

What database are you using? It seems like the timestamps are invalid in the DB.

cfilomena commented 1 year ago

Database is Mysql 8.0, the fixtime column of tc_position is a timestamp. I've found the moment that generate the error.

If I set the start date date at 03/26/2023 01:59 AM the page generate error... but after 2 in the morning it works... I've checked the records on db and seems ok the sequential id shows as fixtime

2023-03-26 01:55:28.000 2023-03-26 03:00:32.000

tananaev commented 1 year ago

Maybe it would be helpful to include the full database records for the error.

cfilomena commented 1 year ago
"id","protocol","deviceid","servertime","devicetime","fixtime","valid","latitude","longitude","altitude","speed","course","address","attributes","accuracy","network","geofenceids"
251381,teltonika,3,2023-03-26 01:55:31.000,2023-03-26 01:55:28.000,2023-03-26 01:55:28.000,1,00.0000000,00.0000000,65.0,0.0,126.0,,"{""priority"":0,""sat"":14,""event"":246,""ignition"":false,""motion"":false,""rssi"":3,""io200"":0,""io69"":1,""io246"":0,""pdop"":1.0,""hdop"":0.6000000000000001,""power"":12.73,""battery"":4.033,""io68"":0,""operator"":00000,""odometer"":11950420,""distance"":0.0,""totalDistance"":8.785552889E7,""hours"":129901910}",0.0,null,
251382,teltonika,3,2023-03-26 03:01:55.000,2023-03-26 03:00:32.000,2023-03-26 03:00:32.000,1,00.0000000,00.0000000,67.0,0.0,331.0,,"{""priority"":0,""sat"":13,""event"":0,""ignition"":false,""motion"":false,""rssi"":3,""io200"":0,""io69"":1,""pdop"":1.1,""hdop"":0.8,""power"":13.315,""battery"":3.952,""io68"":0,""operator"":00000,""odometer"":11950420,""distance"":4.19,""totalDistance"":8.785553308E7,""hours"":129901910}",0.0,null,
tananaev commented 1 year ago

Interesting. It looks like that timestamp is invalid because of the DTS time switch.

cfilomena commented 1 year ago

Correct. I've forced TZ in the docker environment (of db and traccar server) and even if probably is not necessary into the jdbc string

docker-compose

environment:
  TZ: Europe/Rome

jdbc

....&useLegacyDatetimeCode=false&serverTimezone=Europe/Rome

Now it works! Thanks