Skip to content

High performance self-hosted photo and video management solution.

fix(mobile): allow editing asset dates in the future (#5522)

shenlonge1739ac4fc73
diff --git a/mobile/lib/shared/ui/date_time_picker.dart b/mobile/lib/shared/ui/date_time_picker.dart
index 6c7ea16cee..adc2092f87 100644
--- a/mobile/lib/shared/ui/date_time_picker.dart
+++ b/mobile/lib/shared/ui/date_time_picker.dart
@@ -86,11 +86,14 @@ class _DateTimePicker extends HookWidget {
final timeZones = useMemoized(() => getAllTimeZones(), const []);
void pickDate() async {
+ final now = DateTime.now();
+ // Handles cases where the date from the asset is far off in the future
+ final initialDate = date.value.isAfter(now) ? now : date.value;
final newDate = await showDatePicker(
context: context,
- initialDate: date.value,
+ initialDate: initialDate,
firstDate: DateTime(1800),
- lastDate: DateTime.now(),
+ lastDate: now,
);
if (newDate == null) {
return;