I've got a problem with DateTime and I don't know what's the matter. I got a calendar app. When I switch the month forward to October of the current year (or the October of the next year, same issue) the October shows a quantity of 32 days. The other months work properly. I don't know where the problem is. I show some code, but I'm not sure, whether there is a problem in my code or in the DateTime object.
@override
Widget build(BuildContext context) {
final userModelData = Provider.of<UserModel>(context);
final userModel = userModelData.items;
final dateModelData = Provider.of<DateModel>(context);
final actualDate = dateModelData.getActualSavedDate!;
final actualDateTestMonth = dateModelData.getActualSavedDate!.month;
final dateMonthTest = dateModelData.getMonat;
final anzahlColumns = userModel.length;
var dateMonth = DateTime(actualDate.year, actualDate.month, actualDate.day)
.getDaysInMonth;
var wochenTag = DateTime(
actualDate.year,
actualDate.month,
);
List<User> listeColumns() {
List<User> gesamteColumns = [];
for (int d = 1; d <= anzahlColumns; d++) {
gesamteColumns.add(userModel[d - 1]);
}
//gesamteColumns += ['gemeinsame Termine', 'Geburtstage'];
return gesamteColumns;
}
List<String> listeRows() {
List<String> gesamteRows = [];
for (int d = 1; d <= dateMonth; d++)
gesamteRows.add(
actualDate.format('$d'),
);
return gesamteRows;
}
...