mirror of
https://github.com/robertvokac/time-calc.git
synced 2025-03-25 07:27:49 +01:00
Fixed loading day maximum for given month, because Java SE class Calendar.getActualMaximum is buggy, if current day of month is 31
This commit is contained in:
parent
dec4b214ce
commit
6c7e6a7e46
@ -336,6 +336,19 @@ public class WorkingDaysWindow extends TWindow {
|
|||||||
cal.set(Calendar.YEAR, year);
|
cal.set(Calendar.YEAR, year);
|
||||||
cal.set(Calendar.MONTH, month - 1);
|
cal.set(Calendar.MONTH, month - 1);
|
||||||
int dayMaximum = month ==2 ? (year % 4 == 0 ? 29 : 28) : cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
int dayMaximum = month ==2 ? (year % 4 == 0 ? 29 : 28) : cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||||
|
switch(month) {
|
||||||
|
case 1: dayMaximum = 31; break;
|
||||||
|
case 3: dayMaximum = 31; break;
|
||||||
|
case 4: dayMaximum = 30; break;
|
||||||
|
case 5: dayMaximum = 31; break;
|
||||||
|
case 6: dayMaximum = 30; break;
|
||||||
|
case 7: dayMaximum = 31; break;
|
||||||
|
case 8: dayMaximum = 31; break;
|
||||||
|
case 9: dayMaximum = 30; break;
|
||||||
|
case 10: dayMaximum = 31; break;
|
||||||
|
case 11: dayMaximum = 30; break;
|
||||||
|
case 12: dayMaximum = 31; break;
|
||||||
|
}
|
||||||
for (int day = 1; day <= dayMaximum; day++) {
|
for (int day = 1; day <= dayMaximum; day++) {
|
||||||
|
|
||||||
WorkingDay wd = workingDayRepository.read(year, month, day);
|
WorkingDay wd = workingDayRepository.read(year, month, day);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user