Properly handle timezones

This should (hopefully 🤞) take care of problems saving entries with timezone
information.
This commit is contained in:
Roland Geider
2025-11-18 15:32:23 +01:00
parent e0b0aba979
commit fc881c4929
25 changed files with 130 additions and 118 deletions

View File

@@ -18,8 +18,8 @@
import 'package:wger/models/body_weight/weight_entry.dart';
final testWeightEntry1 = WeightEntry(id: 1, weight: 80, date: DateTime(2021, 01, 01, 15, 30));
final testWeightEntry2 = WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10, 10, 0));
final testWeightEntry1 = WeightEntry(id: 1, weight: 80, date: DateTime.utc(2021, 01, 01, 15, 30));
final testWeightEntry2 = WeightEntry(id: 2, weight: 81, date: DateTime.utc(2021, 01, 10, 10, 0));
List<WeightEntry> getWeightEntries() {
return [testWeightEntry1, testWeightEntry2];
@@ -27,20 +27,20 @@ List<WeightEntry> getWeightEntries() {
List<WeightEntry> getScreenshotWeightEntries() {
return [
WeightEntry(id: 1, weight: 86, date: DateTime(2021, 01, 01)),
WeightEntry(id: 2, weight: 81, date: DateTime(2021, 01, 10)),
WeightEntry(id: 3, weight: 82, date: DateTime(2021, 01, 20)),
WeightEntry(id: 4, weight: 83, date: DateTime(2021, 01, 30)),
WeightEntry(id: 5, weight: 86, date: DateTime(2021, 02, 20)),
WeightEntry(id: 6, weight: 90, date: DateTime(2021, 02, 28)),
WeightEntry(id: 7, weight: 91, date: DateTime(2021, 03, 20)),
WeightEntry(id: 8, weight: 91.1, date: DateTime(2021, 03, 30)),
WeightEntry(id: 9, weight: 90, date: DateTime(2021, 05, 1)),
WeightEntry(id: 10, weight: 91, date: DateTime(2021, 6, 5)),
WeightEntry(id: 11, weight: 89, date: DateTime(2021, 6, 20)),
WeightEntry(id: 12, weight: 88, date: DateTime(2021, 7, 15)),
WeightEntry(id: 13, weight: 86, date: DateTime(2021, 7, 20)),
WeightEntry(id: 14, weight: 83, date: DateTime(2021, 7, 30)),
WeightEntry(id: 15, weight: 80, date: DateTime(2021, 8, 10)),
WeightEntry(id: 1, weight: 86, date: DateTime.utc(2021, 01, 01)),
WeightEntry(id: 2, weight: 81, date: DateTime.utc(2021, 01, 10)),
WeightEntry(id: 3, weight: 82, date: DateTime.utc(2021, 01, 20)),
WeightEntry(id: 4, weight: 83, date: DateTime.utc(2021, 01, 30)),
WeightEntry(id: 5, weight: 86, date: DateTime.utc(2021, 02, 20)),
WeightEntry(id: 6, weight: 90, date: DateTime.utc(2021, 02, 28)),
WeightEntry(id: 7, weight: 91, date: DateTime.utc(2021, 03, 20)),
WeightEntry(id: 8, weight: 91.1, date: DateTime.utc(2021, 03, 30)),
WeightEntry(id: 9, weight: 90, date: DateTime.utc(2021, 05, 1)),
WeightEntry(id: 10, weight: 91, date: DateTime.utc(2021, 6, 5)),
WeightEntry(id: 11, weight: 89, date: DateTime.utc(2021, 6, 20)),
WeightEntry(id: 12, weight: 88, date: DateTime.utc(2021, 7, 15)),
WeightEntry(id: 13, weight: 86, date: DateTime.utc(2021, 7, 20)),
WeightEntry(id: 14, weight: 83, date: DateTime.utc(2021, 7, 30)),
WeightEntry(id: 15, weight: 80, date: DateTime.utc(2021, 8, 10)),
];
}