I hoping anyone can point me in the right direction for my struggle with selecting database records within a date range, where the database is in UTC and the date range (to and from) should be considered in the local time zone of the user.
Without the date filter, the user just sees all records in his account.
The user can add a date filter and set a from date and a to date.
The corresponding route is Route::get('data/{id}/from/{from}/to/{to}', 'DataController@show')
The dates from the request should be treated as dates according to user timezone.
However the data I need to fetch from the database is in UTC.
When a user timezone is UTC too, it works just fine. But for any other timezone, I'm not getting the results I expect, but often shifted a day earlier or later. I could probably work out a function to calculate hours to add or substract, but there should probably be a "Laravel way" to do this.
Any ideas?