Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.58k
stars
775
forks
source link
Not correct Datetime values, when daylight time changed #2154
We are using Bar Chart in our App from syncfusion_flutter_charts and problem occured when time changed In Germany. After 27th of October AxisLabelRenderDetails details.value became strange. We receive Datetime value for 27th of October twice. For example below is values for one week.
1 day duration becomes 23 hours.
Screenshots / Video demonstration
![Screenshot 2024-10-29 at 20 43 50](https://github.com/user-attachments/assets/2eff4f4e-4d1d-4cd2-ba2e-4a66b7658533)
Stack Traces
Stack Traces
```dart
It is not strack trace
```
On which target platforms have you observed this bug?
Android
Flutter Doctor output
Doctor output
```console
[✓] Flutter (Channel stable, 3.22.1, on macOS 15.0.1 24A348 darwin-arm64, locale en-DE)
• Flutter version 3.22.1 on channel stable at /Users/elvinmammadov/Downloads/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision a14f74ff3a (5 months ago), 2024-05-22 11:08:21 -0500
• Engine revision 55eae6864b
• Dart version 3.4.1
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc4)
• Android SDK at /Users/elvinmammadov/Library/Android/sdk
• Platform android-35, build-tools 35.0.0-rc4
• 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 16.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16A242d
• 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)
[✓] Connected device (4 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 15.0.1 24A348 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0.1 24A348 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.70
[✓] Network resources
• All expected network resources are available.
• No issues found!
```
Bug description
We are using Bar Chart in our App from syncfusion_flutter_charts and problem occured when time changed In Germany. After 27th of October AxisLabelRenderDetails details.value became strange. We receive Datetime value for 27th of October twice. For example below is values for one week. 1 day duration becomes 23 hours.
I/flutter (20731): graphDate: 2024-10-23 00:00:00.000 I/flutter (20731): graphDate: 2024-10-24 00:00:00.000 I/flutter (20731): graphDate: 2024-10-25 00:00:00.000 I/flutter (20731): graphDate: 2024-10-26 00:00:00.000 I/flutter (20731): graphDate: 2024-10-27 00:00:00.000 I/flutter (20731): graphDate: 2024-10-27 23:00:00.000 I/flutter (20731): graphDate: 2024-10-28 23:00:00.000
Steps to reproduce
Code sample
Code sample
```dart SfCartesianChart( backgroundColor: theme.own().colors.backgroundBlankLight, plotAreaBorderWidth: 0, series: widget.series, primaryXAxis: DateTimeAxis( majorTickLines: MajorTickLines( color: theme.own().colors.dividerLight, ), axisLine: AxisLine( color: theme.own().colors.dividerLight, ), majorGridLines: const MajorGridLines(width: 0), intervalType: DateTimeIntervalType.days, maximumLabels: week, dateFormat: DateFormat("E"), labelStyle: theme.own().textStyle.bodyExtraSmall.copyWith( color: theme.own().colors.textSecondary, ), initialVisibleMaximum: visibleMaximum, initialVisibleMinimum: visibleMinimum, interval: 1, axisLabelFormatter: (AxisLabelRenderDetails details) => _axisLabelFormatter( details: details, theme: theme, ), onRendererCreated: (DateTimeAxisController controller) { chartController = controller; }, ), primaryYAxis: NumericAxis( axisLine: AxisLine(color: theme.own().colors.dividerLight), majorGridLines: const MajorGridLines(width: 0), majorTickLines: const MajorTickLines(width: 0), numberFormat: NumberFormat.decimalPattern(widget.locale), labelStyle: theme.own().textStyle.bodyExtraSmall.copyWith( color: theme.own().colors.textSecondary, ), opposedPosition: true, ), onPlotAreaSwipe: (ChartSwipeDirection direction) { if (direction == ChartSwipeDirection.end) { maxVisibleIndex = min(maxVisibleIndex + week, dataSource.length - 1); } else { maxVisibleIndex = max(maxVisibleIndex - week, week - 1); } _setVisibleWeak(); }, onSelectionChanged: (SelectionArgs selection) { if (currentIndex != selection.pointIndex) { setState(() { currentIndex = selection.pointIndex; maxVisibleIndex = max(currentIndex + week ~/ 2, week - 1); _selectBar(); _setVisibleWeak(); }); } }, ), ChartAxisLabel _axisLabelFormatter({ required AxisLabelRenderDetails details, required ThemeData theme, }) { String label = details.text.toUpperCase(); TextStyle textStyle = details.textStyle; final DateTime graphDate = DateTime.fromMillisecondsSinceEpoch(details.value.toInt()); final DateTime? visibleMinimum = this.visibleMinimum?.add( const Duration(hours: midday), ); print('graphDate: $graphDate'); if (dataSource[currentIndex].dateTime.isSameDate(graphDate)) { final String date = du.DateUtils.formatMonthDayMonth(graphDate); label += "\n $date"; textStyle = textStyle.copyWith( color: theme.own().colors.textPrimary, ); } else if (visibleMinimum != null && visibleMinimum.isSameDate(graphDate)) { final String date = du.DateUtils.formatMonthDayMonth(visibleMinimum); label += "\n $date"; } else if (visibleMaximum != null && visibleMaximum!.isSameDate(graphDate)) { final String date = du.DateUtils.formatMonthDayMonth(visibleMaximum!); label += "\n $date"; } else { label += "\n"; } return ChartAxisLabel( label, textStyle, ); } ```Screenshots or Video
Screenshots / Video demonstration
![Screenshot 2024-10-29 at 20 43 50](https://github.com/user-attachments/assets/2eff4f4e-4d1d-4cd2-ba2e-4a66b7658533)Stack Traces
Stack Traces
```dart It is not strack trace ```On which target platforms have you observed this bug?
Android
Flutter Doctor output
Doctor output
```console [✓] Flutter (Channel stable, 3.22.1, on macOS 15.0.1 24A348 darwin-arm64, locale en-DE) • Flutter version 3.22.1 on channel stable at /Users/elvinmammadov/Downloads/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision a14f74ff3a (5 months ago), 2024-05-22 11:08:21 -0500 • Engine revision 55eae6864b • Dart version 3.4.1 • DevTools version 2.34.3 [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc4) • Android SDK at /Users/elvinmammadov/Library/Android/sdk • Platform android-35, build-tools 35.0.0-rc4 • 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 16.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 16A242d • 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) [✓] Connected device (4 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 14 (API 34) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 15.0.1 24A348 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0.1 24A348 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.70 [✓] Network resources • All expected network resources are available. • No issues found! ```