fix(mobile): allow editing asset dates in the future (#5522)
Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
8736c77f7a
commit
e1739ac4fc
1 changed files with 5 additions and 2 deletions
|
@ -86,11 +86,14 @@ class _DateTimePicker extends HookWidget {
|
||||||
final timeZones = useMemoized(() => getAllTimeZones(), const []);
|
final timeZones = useMemoized(() => getAllTimeZones(), const []);
|
||||||
|
|
||||||
void pickDate() async {
|
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(
|
final newDate = await showDatePicker(
|
||||||
context: context,
|
context: context,
|
||||||
initialDate: date.value,
|
initialDate: initialDate,
|
||||||
firstDate: DateTime(1800),
|
firstDate: DateTime(1800),
|
||||||
lastDate: DateTime.now(),
|
lastDate: now,
|
||||||
);
|
);
|
||||||
if (newDate == null) {
|
if (newDate == null) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue