formatMonth function
Implementation
String formatMonth(DateTime dateTime, {int? characters}) {
switch (dateTime.month) {
case 1:
return 'Enero'.substring(
0,
(characters != null && characters > 0 && characters <= 'Enero'.length)
? characters
: null);
case 2:
return 'Febrero'.substring(
0,
(characters != null &&
characters > 0 &&
characters <= 'Febrero'.length)
? characters
: null);
case 3:
return 'Marzo'.substring(
0,
(characters != null && characters > 0 && characters <= 'Marzo'.length)
? characters
: null);
case 4:
return 'Abril'.substring(
0,
(characters != null && characters > 0 && characters <= 'Abril'.length)
? characters
: null);
case 5:
return 'Mayo'.substring(
0,
(characters != null && characters > 0 && characters <= 'Mayo'.length)
? characters
: null);
case 6:
return 'Junio'.substring(
0,
(characters != null && characters > 0 && characters <= 'Junio'.length)
? characters
: null);
case 7:
return 'Julio'.substring(
0,
(characters != null && characters > 0 && characters <= 'Julio'.length)
? characters
: null);
case 8:
return 'Agosto'.substring(
0,
(characters != null &&
characters > 0 &&
characters <= 'Agosto'.length)
? characters
: null);
case 9:
return 'Septiembre'.substring(
0,
(characters != null &&
characters > 0 &&
characters <= 'Septiembre'.length)
? characters
: null);
case 10:
return 'Octubre'.substring(
0,
(characters != null &&
characters > 0 &&
characters <= 'Octubre'.length)
? characters
: null);
case 11:
return 'Noviembre'.substring(
0,
(characters != null &&
characters > 0 &&
characters <= 'Noviembre'.length)
? characters
: null);
case 12:
return 'Diciembre'.substring(
0,
(characters != null &&
characters > 0 &&
characters <= 'Diciembre'.length)
? characters
: null);
default:
return '';
}
}