smartDateTimeFormat function
Implementation
String smartDateTimeFormat(DateTime dateTime) {
final TZDateTime toFormat = tzDateTime(dateTime);
final now = TZDateTime.now(toFormat.location);
final date = toFormat.toLocal();
if (now.day == date.day) {
return formatDateTimeSameDay(date);
} else if (now.year == date.year) {
return formatDateTimeSameYear(date);
} else {
return formatDateTimeWithYear(date);
}
}