Open Brechard opened 3 weeks ago
Hi @Brechard,
We have checked the events with timeZone as UTC<0 and tried to replicate in SfCalendar with version 26.2.12 by enabling the timeZone property. However, we were unable to reproduce it on our end. Please check the attached sample, and if you are still experiencing the issue, we request that you replicate it in the attached sample and provide us with more details regarding the specific scenario in which you are encountering this issue. This will help us to assist you more effectively.
Sample : gh_2039.zip
Regards, S Thilip Chandru.
Hi @ThilipChandru sorry I was probably not clear enough with the bug. The problem arises when the phone timezone is set to < 0, not the timezone of the event, the event data is in UTC, it is an ALL DAY event, and the phone timezone is set to < 0. To replicate the issue you need one simulated phone with UTC > 0 timezone, and the other simulator with timezone UTC < 0. And here is the code that you execute in both phones:
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SizedBox(
child: SfCalendar(
view: CalendarView.day,
dataSource: _getCalendarDataSource(),
),
),
);
}
}
_AppointmentDataSource _getCalendarDataSource() {
DateTime t = DateTime.now().toUtc().copyWith(hour: 0, minute: 0, second: 0, millisecond: 0);
appointments.add(Appointment(
startTime: t,
endTime: t,
isAllDay: true,
subject: 'Meeting',
color: Colors.blue,
));
return _AppointmentDataSource(appointments);
}
Bug description
When using the calendar view on the day CalendarView.day and the phone is on a timezone that is on UTC < 0 (e.g. America) the events that are full day are shown the day before they should (e.g. an event with date: 2024-08-27 00:00:00.000Z is shown the 26th August instead of the 27th).
I have tried every view and the error only happens on the daily one, and it only happens when the timezone is in UTC < 0, all the rest work properly.
Steps to reproduce
Code sample
Code sample
```dart [Add your code here] ```Screenshots or Video
Screenshots / Video demonstration
[Upload media here]Stack Traces
Stack Traces
```dart [Add the Stack Traces here] ```On which target platforms have you observed this bug?
Android, iOS
Flutter Doctor output