flutter_local_notifications
flutter_local_notifications copied to clipboard
TZDateTime's (.from) Method Not Creating Notifications
I am having issue, When I Use tz.TZDateTime function .from local notification not posting.
However when I use TZDateTime.now function it works fine,
I have logged and checked both the times are same..
//2022-07-13 06:06:34.201134Z - .now method //2022-07-13 06:07:10.000Z - .from method I see the format differs on Milli and micro seconds, Maybe that would be a reason ?
Below is my code.
Get local timezone from different library. as suggested on documentation.
tz.initializeTimeZones(); final String timeZone = await FlutterNativeTimezone.getLocalTimezone(); print("timeZone -- " + timeZone); var zone = tz.getLocation(timeZone); tz.setLocalLocation(zone);
tz.TZDateTime object to schedule notification on particular time..
Below code Works: final tz.TZDateTime localNotificationCurrentTime = await tz.TZDateTime.now(tz.local).add(const Duration(seconds: 10));
Below code doesn't work. DateTime dateForNotification = MycustomDateTime based on picker.
final tz.TZDateTime localNotificationSpecifiedTime = await tz.TZDateTime.from(dateForNotification, tz.local);
I see the format differs on Milli and micro seconds, Maybe that would be a reason ?
The format is still the same
As for your issue, you're going to need to provide a link to repo hosting a minimal app that can reproduce the issue you're describing. Forking the repository and updating the example app is one of that this can be done. I've tried this myself using my local timezone (Sydney) without issues and I know there are others the community that have used TZDateTime.from
before e.g. https://github.com/MaikuB/flutter_local_notifications/issues/834
Closing due to lack of response. Feel free to re-open the issue provided you can provide the requested information
Having the same issue. On iOS only ...