overrideFormatters method

  1. @override
FormatSetOptional overrideFormatters()
override

Implementation

@override
FormatSetOptional overrideFormatters() {
  return {
    // From [Ordinal] mixin
    ...formattersWithOrdinal,
    // Localization aware formats
    FormatterToken.L: (dateTime) => reformat(dateTime, "YYYY/MM/DD"),
    FormatterToken.l: (dateTime) => reformat(dateTime, "YYYY/M/D"),
    FormatterToken.LL: (dateTime) =>
        reformat(dateTime, "YYYY ᠣᠨ ᠤ MMMM ᠶᠢᠨ D"),
    FormatterToken.ll: (dateTime) =>
        reformat(dateTime, "YYYY ᠣᠨ ᠤ MMM ᠶᠢᠨ D"),
    FormatterToken.LLL: (dateTime) =>
        reformat(dateTime, "YYYY ᠣᠨ ᠤ MMMM ᠶᠢᠨ D᠂ HH:mm"),
    FormatterToken.lll: (dateTime) =>
        reformat(dateTime, "YYYY ᠣᠨ ᠤ MMM ᠶᠢᠨ D᠂ H:mm"),
    FormatterToken.LLLL: (dateTime) =>
        reformat(dateTime, "dddd, YYYY ᠣᠨ ᠤ MMMM ᠶᠢᠨ D᠂ HH:mm"),
    FormatterToken.llll: (dateTime) =>
        reformat(dateTime, "ddd, YYYY ᠣᠨ ᠤ MMM ᠶᠢᠨ D᠂ H:mm"),
    FormatterToken.LT: (dateTime) => reformat(dateTime, "HH:mm"),
    FormatterToken.LTS: (dateTime) => reformat(dateTime, "HH:mm:ss"),
    // Missings
    FormatterToken.MMM: (dateTime) => "${dateTime.month} ᠰᠠᠷ᠎ᠠ",
    FormatterToken.MMMM: (dateTime) => monthName(dateTime.month),
    FormatterToken.A: (dateTime) =>
        dateTime.hour < 12 ? "ᠦᠳᠡ ᠡᠴᠡ ᠡᠮᠦᠨ᠎ᠡ" : "ᠦᠳᠡ ᠡᠴᠡ ᠬᠣᠢᠢᠰᠢ",
    FormatterToken.a: (dateTime) =>
        dateTime.hour < 12 ? "ᠦᠳᠡ ᠡᠴᠡ ᠡᠮᠦᠨ᠎ᠡ" : "ᠦᠳᠡ ᠡᠴᠡ ᠬᠣᠢᠢᠰᠢ",

    FormatterToken.dd: (dateTime) => weekdayNameShort[dateTime.weekday]!,
    FormatterToken.ddd: (dateTime) => weekdayName[dateTime.weekday]!,
    FormatterToken.dddd: (dateTime) =>
        "${weekdayName[dateTime.weekday]!} ᠡᠳᠦᠷ",
  };
}