toMonthName method
Implementation
String toMonthName({bool isHalfName = false}) {
String status = '';
if (!(this! >= 1 && this! <= 12)) {
throw Exception('Invalid day of month');
}
if (this == 1) {
return status = isHalfName ? 'Jan' : 'January';
} else if (this == 2) {
return status = isHalfName ? 'Feb' : 'February';
} else if (this == 3) {
return status = isHalfName ? 'Mar' : 'March';
} else if (this == 4) {
return status = isHalfName ? 'Apr' : 'April';
} else if (this == 5) {
return status = isHalfName ? 'May' : 'May';
} else if (this == 6) {
return status = isHalfName ? 'Jun' : 'June';
} else if (this == 7) {
return status = isHalfName ? 'Jul' : 'July';
} else if (this == 8) {
return status = isHalfName ? 'Aug' : 'August';
} else if (this == 9) {
return status = isHalfName ? 'Sept' : 'September';
} else if (this == 10) {
return status = isHalfName ? 'Oct' : 'October';
} else if (this == 11) {
return status = isHalfName ? 'Nov' : 'November';
} else if (this == 12) {
return status = isHalfName ? 'Dec' : 'December';
}
return status;
}