aragaer / jtt_android

android jtt app
MIT License
13 stars 6 forks source link

Crashes when location doesn't match timezone #18

Closed aragaer closed 7 years ago

aragaer commented 7 years ago

When location set in the application doesn't match the actual timezone and the difference is big enough, it is possible that sunrise or sunset time for that location in current timezone is either before or after the local midnight. In this case the sunrise-sunset library will add or subtract 24 hours which would result in sunset for the day being earlier than sunrise. This in turn fails the assertion check when constructing the daylight interval object.

The solution that does work (it allows to start the application to actually set the correct location at least) is to do all the calculations in the timezone that is closest to the current location.