androidEventDateParser property
read / write
Function to use when unserializing event dates on Android.
The following default mimics the behavior of the default Android App version 3.38.1 where dates are of the form YYYY-MM-DD or --MM-DD for dates with no year.
Implementation
Event Function(String) androidEventDateParser = (date) {
if (_dateRegexp.hasMatch(date)) {
return Event(DateTime(int.parse(date.substring(0, 4)),
int.parse(date.substring(5, 7)), int.parse(date.substring(8, 10))));
}
if (_noYearDateRegexp.hasMatch(date)) {
return Event(
DateTime(1970, int.parse(date.substring(2, 4)),
int.parse(date.substring(5, 7))),
noYear: true);
}
return Event(
DateTime.tryParse(date) ?? DateTime.fromMillisecondsSinceEpoch(0));
};