getFirstAndLastDateOfMonth static method
Implementation
static List<Map<String, dynamic>> getFirstAndLastDateOfMonth(
DateTime dateTime) {
List<Map<String, dynamic>> firstAndLastDateOfMonth = [];
int lastday = DateTime(dateTime.year, dateTime.month + 1, 0).day;
int month = DateTime(dateTime.year, dateTime.month + 1, 0).month;
int year = DateTime(dateTime.year, dateTime.month + 1, 0).year;
String lastDateOfMonth = '$year-$month-$lastday';
String firstDateOfMonth = '$year-$month-01';
firstAndLastDateOfMonth.add({
"first_date_of_month": firstDateOfMonth,
"last_date_of_month": lastDateOfMonth
});
return firstAndLastDateOfMonth;
}