Hi. How do you guys observe time zone? I found TimeZone.currentSystemDefault from kotlinx dateTime but this does not provide updates
a
Alexandru Caraus
01/29/2025, 5:56 PM
Wow, you live on the border between two timezones? Never heard anyone needing that.
You can check that with gps location somehow.
r
rkechols
01/29/2025, 8:45 PM
Are you asking for something observable that triggers when timezone changes? I don't know if that exists, but you can always build something that polls for it.
You could usa a StateFlow, with a coroutine that runs an infinite loop to poll the current timezone and put the latest into the flow, calling
delay
between checks
👍 1
c
Csaba Szugyiczki
01/30/2025, 8:28 AM
Eg. on mobile apps it can be an issue, that when you cross borders/states, you want to update your UI to show the times in the new timezone. But basically any user facing interface can benefit of showing data in the users chosen language/locale and date/time settings