I am working on a mobile app using react-native. One of the features of the app is to show a notification to the user at times that are configured by the user in the app like reminders. When a user configures such reminders, I schedule local notifications that are shown to the user at the configured times. The problem arises when there is a change in timezone either due to user moving to a different timezone or because of start or end of daylight savings. This will skew the notification time by the change in timezone offset. I wanted to know if there is a way to detect change in timezone like we can detect change in connection state using NetInfo
class or change in app state using AppState
class. Then I can maybe reschedule the notifications w.r.t. the timezone change.
One solution that comes to mind is that I store the current timezone in AsyncStorage and compare it against the timezone whenever the app state changes to active. If the timezone has changes, then do some actions and store the new timezone. This may work but I wanted to know if there is any other better way of achieving it. I am a beginner at best in native iOS and Android and maybe there is some native function that can help with this requirement.
Thanks!