Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar day view shows all day events the day prior when timezone is UTC < 0 #2039

Open
Brechard opened this issue Aug 26, 2024 · 3 comments
Labels
calendar Calendar component waiting for customer response Cannot make further progress until the customer responds.

Comments

@Brechard
Copy link

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

  1. Create an event with datetime "2024-08-27 00:00:00.000Z"
  2. Have the phone with timezone anywhere in America
  3. Show it on the calendar with option CalendarView.day
  4. The event is shown the 26th instead of the 27th

Code sample

Code sample
[Add your code here]

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Stack Traces

Stack Traces
[Add the Stack Traces here]

On which target platforms have you observed this bug?

Android, iOS

Flutter Doctor output

[✓] Flutter (Channel stable, 3.24.1, on macOS 14.5 23F79 darwin-arm64, locale en-US)
    • Flutter version 3.24.1 on channel stable at /Users/brechard/software/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5874a72aa4 (6 days ago), 2024-08-20 16:46:00 -0500
    • Engine revision c9b9d5780d
    • Dart version 3.5.1
    • DevTools version 2.37.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/brechard/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.90.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (4 available)
    • iPad (6th generation) (mobile)  • D0C97538-3325-4915-BC2B-46B6822F06BB • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-17-4 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 127.0.6533.120

[✓] Network resources
    • All expected network resources are available.
@VijayakumarMariappan VijayakumarMariappan added calendar Calendar component open Open labels Aug 27, 2024
@ghost
Copy link

ghost commented Sep 4, 2024

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.

@LavanyaGowtham2021 LavanyaGowtham2021 added waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels Sep 5, 2024
@Brechard
Copy link
Author

Brechard commented Sep 9, 2024

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);
}

@LavanyaGowtham2021 LavanyaGowtham2021 added open Open and removed waiting for customer response Cannot make further progress until the customer responds. labels Jan 13, 2025
@Mugunthan-Ramalingam
Copy link
Contributor

Hi @Brechard,

We have analyzed your query and identified that the issue occurs because timezone is not applicable for ⁠all-day appointments, which causes them to span two dates when the appointment timezone and the device timezone is differ. To resolve this, you can use the timezone property in SfCalendar and display the appointments based on the timezone provided in the SfCalendar.

For more details, please refer the following UG: https://help.syncfusion.com/flutter/calendar/timezone#create-appointment-in-different-time-zones

Regards,
Mugunthan.

@LavanyaGowtham2021 LavanyaGowtham2021 added waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
calendar Calendar component waiting for customer response Cannot make further progress until the customer responds.
Projects
None yet
Development

No branches or pull requests

10 participants
@Brechard @LavanyaGowtham2021 @VijayakumarMariappan @Mugunthan-Ramalingam and others