dateFormatPattern method

String dateFormatPattern(
  1. bool hasLocale
)

Get a pattern string for DateFormat package

If hasLocale is true, it return standarised ICU pattern to prepare localization

Implementation

String dateFormatPattern(bool hasLocale) {
  switch (this) {
    case MonthApperance.fullname:
      return hasLocale ? "yMMMM" : "MMMM, yyyy";
    case MonthApperance.short_name:
      return hasLocale ? "yMMM" : "MMM, yyyy";
    case MonthApperance.numeric:
      return hasLocale ? "yM" : "M/yyyy";
  }
}