getDateComponentOrder method

String getDateComponentOrder()

The order of the day/month/year components in this locale's date format, as a string of d, m, and y (e.g. 'dmy', 'mdy').

Implementation

String getDateComponentOrder() {
  final Map<String, dynamic>? calFormats = _getCalendarFormats();
  if (calFormats == null) {
    return 'dmy';
  }
  final Map<String, dynamic>? dateFormats =
      calFormats['date'] as Map<String, dynamic>?;
  if (dateFormats == null) {
    return 'dmy';
  }
  final String tmpl = _getLengthFormat(dateFormats['dmy'], 'l') ?? 'dMy';
  return tmpl
      .replaceAll(RegExp(r'[^dMy]'), '')
      .replaceAll(RegExp(r'y+'), 'y')
      .replaceAll(RegExp(r'd+'), 'd')
      .replaceAll(RegExp(r'M+'), 'm');
}