selectDate function
Implementation
Future<DateTime> selectDate(BuildContext context, int startTimestamp, int? selectedTimestamp) async {
DateTime selectedDate = DateTime.now();
final DateTime? picked = await showDatePicker(
context: context,
initialDate: DateTime.fromMillisecondsSinceEpoch(selectedTimestamp ?? startTimestamp),
firstDate: DateTime.fromMillisecondsSinceEpoch(startTimestamp),
lastDate: DateTime(2101));
if (picked != null && picked != selectedDate) selectedDate = picked;
return selectedDate;
}