Skip to content

Commit 573b69d

Browse files
authored
Merge pull request #269 from Kaps61929/fix/date_format_corected_edit_due
Fix/date format corected edit due
2 parents 7623a90 + e6cd47a commit 573b69d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/widgets/taskdetails/dateTimePicker.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ class DateTimeWidget extends StatelessWidget {
6262
),
6363
),
6464
onTap: () async {
65-
var initialDate = DateFormat("dd-MM-yyyy HH:mm").parse(
66-
value ?? DateFormat("dd-MM-yyyy HH:mm").format(DateTime.now()));
67-
// var initialDate = DateTime.tryParse('$value') ?? DateTime.now();
65+
var initialDate = DateFormat("E, M/d/y h:mm:ss a").parse(
66+
value?.replaceAll(RegExp(r'\s+'), ' ') ??
67+
DateFormat("E, M/d/y h:mm:ss a").format(DateTime.now()));
68+
6869
var date = await showDatePicker(
6970
context: context,
7071
initialDate: initialDate,
71-
firstDate: DateTime.now(), // sets the earliest selectable date to the current date. This prevents the user from selecting a date in the past.
72+
firstDate: DateTime
73+
.now(), // sets the earliest selectable date to the current date. This prevents the user from selecting a date in the past.
7274
lastDate: DateTime(2037, 12, 31), // < 2038-01-19T03:14:08.000Z
7375
);
7476
if (date != null) {

0 commit comments

Comments
 (0)