datePickerStandaloneMonth method

  1. @override
String datePickerStandaloneMonth(
  1. int monthIndex
)
override

Month that is shown in CupertinoDatePicker spinner corresponding to the given month index in CupertinoDatePickerMode.monthYear mode.

This is distinct from datePickerMonth because in some languages, like Russian, the name of a month takes a different form depending on whether it is preceded by a day or whether it stands alone.

Examples: datePickerMonth(1) in:

  • US English: January
  • Korean: 1월
  • Russian: Январь

Implementation

@override
String datePickerStandaloneMonth(int monthIndex) {
  // It doesn't actually have anything to do with _fullYearFormat. It's just
  // taking advantage of the fact that _fullYearFormat loaded the needed
  // locale's symbols.
  //
  // Because this will be used without specifying any day of month,
  // in most cases it should be capitalized (according to rules in specific language).
  return intl.toBeginningOfSentenceCase(_fullYearFormat.dateSymbols.STANDALONEMONTHS[monthIndex - 1]) ??
      _fullYearFormat.dateSymbols.STANDALONEMONTHS[monthIndex - 1];
}