diff --git a/mobile/lib/utils/option.dart b/mobile/lib/utils/option.dart index 326b60cb39..4824d9c507 100644 --- a/mobile/lib/utils/option.dart +++ b/mobile/lib/utils/option.dart @@ -29,13 +29,9 @@ sealed class Option { None() => const Option.none(), }; - void ifSome(void Function(T value) action) { - switch (this) { - case Some(:final value): - action(value); - break; - case None(): - break; + void ifPresent(void Function(T value) f) { + if (this case Some(:final value)) { + f(value); } } diff --git a/mobile/lib/widgets/map/map_settings/map_custom_time_range.dart b/mobile/lib/widgets/map/map_settings/map_custom_time_range.dart index 2dc0cdaea4..35d218b0ca 100644 --- a/mobile/lib/widgets/map/map_settings/map_custom_time_range.dart +++ b/mobile/lib/widgets/map/map_settings/map_custom_time_range.dart @@ -19,7 +19,10 @@ class MapTimeRange extends StatelessWidget { ListTile( title: Text(context.t.date_after), subtitle: Text( - timeRange.from.fold((from) => DateFormat.yMMMd().add_jm().format(from), () => context.t.not_set), + timeRange.from.fold( + (from) => DateFormat.yMMMd(context.locale).add_jm().format(from), + () => context.t.not_set, + ), ), trailing: timeRange.from.isSome ? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(timeRange.clearFrom())) @@ -43,7 +46,10 @@ class MapTimeRange extends StatelessWidget { ListTile( title: Text(context.t.date_before), subtitle: Text( - timeRange.to.fold((to) => DateFormat.yMMMd().add_jm().format(to), () => context.t.not_set), + timeRange.to.fold( + (to) => DateFormat.yMMMd(context.locale).add_jm().format(to), + () => context.t.not_set, + ), ), trailing: timeRange.to.isSome ? IconButton(icon: const Icon(Icons.close), onPressed: () => onChanged(timeRange.clearTo()))