preMonth function
Implementation
DateTime preMonth(DateTime date) {
int y = date.year;
int m = date.month;
int d = date.day;
if (m == 1) {
y = y - 1;
m = 12;
} else {
m = m - 1;
}
if (d > getMonthDays(y, m)) {
d = getMonthDays(y, m);
}
return intToDate(y, m, d, h: date.hour, min: date.minute);
}