Skip to content

Conversation

rolandgeider
Copy link
Member

Proposed Changes

We now send the current time zone to the server when serializing datetime objects. This was causing entries to be saved some hours wrong or depending on the time, on a different day.

Related Issue(s)

Closes #576

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Set a 100 character limit in your editor/IDE to avoid white space diffs in the PR
    (run dart format .)
  • Updated/added relevant documentation (doc comments with ///).
  • Added relevant reviewers.

We now send the current time zone to the server when serializing datetime objects.
This was causing entries to be saved some hours wrong or depending on the time, on
a different day.
@rolandgeider rolandgeider requested a review from Copilot August 28, 2025 20:23
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves timezone handling in the wger Workout Manager app by ensuring datetime objects are properly serialized with UTC timezone information to prevent incorrect date/time storage on the server.

  • Introduces a new dateToUtcIso8601 function that converts DateTime objects to UTC before serialization
  • Updates all model classes to use the new timezone-aware serialization
  • Refactors date/time utility functions into a dedicated date.dart helper file

Reviewed Changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
lib/helpers/date.dart New helper file containing date/time utility functions moved from misc.dart
lib/helpers/json.dart Adds new dateToUtcIso8601 function for timezone-aware serialization
lib/models/nutrition/log.dart Updates datetime field to use UTC serialization
lib/models/workouts/log.dart Updates date field to use UTC serialization
lib/models/workouts/routine.dart Updates created field to use UTC serialization
lib/models/nutrition/nutritional_plan.dart Updates creationDate field to use UTC serialization
lib/widgets/nutrition/forms.dart Refactors date/time parsing and updates function names
lib/screens/log_meal_screen.dart Improves date/time handling and UI responsiveness

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

rolandgeider and others added 2 commits August 28, 2025 22:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rolandgeider rolandgeider merged commit 8a1b615 into master Aug 28, 2025
4 checks passed
@rolandgeider rolandgeider deleted the fix/timezone-problems branch September 3, 2025 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

incorrect timezone handling for ingredient logs, causes consumed items to show up for yesterday instead of today
1 participant