shortReadable static method

String shortReadable(
  1. DateTime date
)

Formats date in a short readable format

Example:

DateFormatters.shortReadable(DateTime(2024, 1, 15)); // 'Jan 15, 2024'

Implementation

static String shortReadable(DateTime date) {
  const months = [
    'Jan',
    'Feb',
    'Mar',
    'Apr',
    'May',
    'Jun',
    'Jul',
    'Aug',
    'Sep',
    'Oct',
    'Nov',
    'Dec',
  ];
  return '${months[date.month - 1]} ${date.day}, ${date.year}';
}