dateTimeShort function

String dateTimeShort(
  1. DateTime dt
)

Returns a string of "yyyy-MM-dd" or "HH:mm:ss"

Implementation

String dateTimeShort(DateTime dt) {
  final now = DateTime.now();
  if (dt.year == now.year && dt.month == now.month && dt.day == now.day) {
    return DateFormat.jm().format(dt);
  } else {
    return DateFormat('yy.MM.dd').format(dt);
  }
}