You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
On Android, all day events are returned as a timezone agnostic date, but represented as UTC.
On iOS, all day events are returned as timezone aware date
That is to say, on android if you create an all day event on 13 Sep - the raw date will be 13 Sep 12 AM UTC in every timezone that you set your device.
Android:
I/flutter (12329): device timezone: Asia/Bangkok
I/flutter (12329): chosen timezone: America/Los_Angeles
I/flutter (12329): raw date: 2024-09-13 00:00:00.000+0000
I/flutter (12329): zoned date : 2024-09-12 17:00:00.000-0700
I/flutter (17680): zoned date to utc: 2024-09-13 00:00:00.000Z
I/flutter (12329): device timezone: America/Los_Angeles
I/flutter (12329): chosen timezone: America/Los_Angeles
I/flutter (12329): raw date: 2024-09-13 00:00:00.000+0000
I/flutter (12329): zoned date : 2024-09-12 17:00:00.000-0700
I/flutter (17680): zoned date to utc: 2024-09-13 00:00:00.000Z
On iOS however, if you create an all day event on 13th Sep - the date changes depending on your device location
iOS:
flutter: device timezone: Asia/Bangkok
flutter: chosen timezone: America/Los_Angeles
flutter: raw date: 2024-09-12 17:00:00.000Z
flutter: zoned date : 2024-09-12 10:00:00.000-0700
flutter: zoned date to utc: 2024-09-12 17:00:00.000Z
flutter: device timezone: America/Los_Angeles
flutter: chosen timezone: America/Los_Angeles
flutter: raw date: 2024-09-13 07:00:00.000Z
flutter: zoned date : 2024-09-13 00:00:00.000-0700
flutter: zoned date to utc: 2024-09-13 07:00:00.000Z
Using this code for testing:
final date = TZDateTime.from(event.start!, getLocation(timezone));
if (event.allDay == true) {
FlutterTimezone.getLocalTimezone().then((deviceTimezone) {
print('device timezone: $deviceTimezone');
print('chosen timezone: $timezone');
print('raw date: ${event.start!}');
print('zoned date : $date');
print('zoned date to utc: ${date.toUtc()}');
});
}
Expected behavior
Dates should be consistent.
I think that the android result is the wrong one, since it's representing midnight UTC no matter where your device is (If you are in Los Angeles, it doesn't make sense if the date is set to 13 Sep 12 UTC, because that represents a point in time that it is not)
However, it's worth noting that these are both inconsistent with how google calendar all day events work. Gcal all day events have no timezone associated with them. So they are just a date string: 2024-09-13 and should be treated as local dates
Device(s) tested
Android Emulator & iOS Emulator
The text was updated successfully, but these errors were encountered:
Describe the bug
On Android, all day events are returned as a timezone agnostic date, but represented as UTC.
On iOS, all day events are returned as timezone aware date
That is to say, on android if you create an all day event on 13 Sep - the raw date will be 13 Sep 12 AM UTC in every timezone that you set your device.
Android:
On iOS however, if you create an all day event on 13th Sep - the date changes depending on your device location
iOS:
Using this code for testing:
Expected behavior
Dates should be consistent.
I think that the android result is the wrong one, since it's representing midnight UTC no matter where your device is (If you are in Los Angeles, it doesn't make sense if the date is set to 13 Sep 12 UTC, because that represents a point in time that it is not)
However, it's worth noting that these are both inconsistent with how google calendar all day events work. Gcal all day events have no timezone associated with them. So they are just a date string: 2024-09-13 and should be treated as local dates
Device(s) tested
Android Emulator & iOS Emulator
The text was updated successfully, but these errors were encountered: