formatDate method

String formatDate()

Implementation

String formatDate() {
  final List months = [
    "Jan",
    "Feb",
    "Mar",
    "Apr",
    "May",
    "Jun",
    "Jul",
    "Aug",
    "Sep",
    "Oct",
    "Nov",
    "Dec"
  ];

  // Split the date string into parts
  final parts = this.split("T")[0].split("-");

  // Extract year, month, and day
  final year = int.parse(parts[0]);
  final month = months[int.parse(parts[1]) - 1];
  final day = int.parse(parts[2]);

  // Format the date as "DD Mon YYYY"
  return '$day $month $year';
}