format24 method

String format24(
  1. BuildContext context
)

If the date did not exceed 24 hours will format jms else will format yMMMEd

Implementation

String format24(BuildContext context) {
  var now = DateTime.now();
  if (isAfter(now)) {
    return _format(context, (locale) => DateFormat.yMMMEd(locale));
  } else if (now.difference(this).inHours <= 24) {
    return _format(context, (locale) => DateFormat.jms(locale));
  } else {
    return _format(context, (locale) => DateFormat.yMMMEd(locale));
  }
}