Skip to content

Commit

Permalink
Merge pull request #387 from rsergeychik/fix-daily-summary-chart-tz
Browse files Browse the repository at this point in the history
fix timezones in lastdays chart
  • Loading branch information
dreautall authored May 27, 2024
2 parents d44fff0 + 5cabdc0 commit a3bc2c3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/pages/home/main_charts/lastdays.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import 'package:waterflyiii/extensions.dart';
import 'package:waterflyiii/generated/swagger_fireflyiii_api/firefly_iii.swagger.dart';
import 'package:waterflyiii/widgets/charts.dart';

import 'package:waterflyiii/timezonehandler.dart';

class LastDaysChart extends StatelessWidget {
const LastDaysChart({
super.key,
Expand All @@ -23,10 +25,10 @@ class LastDaysChart extends StatelessWidget {

@override
Widget build(BuildContext context) {
final TimeZoneHandler tzHandler = context.read<FireflyService>().tzHandler;
// Use noon due to dailylight saving time
final DateTime now = DateTime.now()
.toLocal()
.setTimeOfDay(const TimeOfDay(hour: 12, minute: 0));
final DateTime now =
tzHandler.sNow().setTimeOfDay(const TimeOfDay(hour: 12, minute: 0));
final List<DateTime> lastDays = <DateTime>[];
for (int i = 0; i < 7; i++) {
lastDays.add(
Expand Down

0 comments on commit a3bc2c3

Please sign in to comment.