DateTime addMonths(DateTime date, int offset) { int y = date.year; int m = date.month; int mA = y * 12 + m + offset; y = mA ~/ 12; m = mA % 12; return DateTime(y, m); }