Skip to content

Commit

Permalink
fix: [3721] IllegalArgumentException in date picker (#3859)
Browse files Browse the repository at this point in the history
  • Loading branch information
shannah authored Dec 15, 2024
1 parent 329216c commit 1ef5fff
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions CodenameOne/src/com/codename1/ui/spinner/DateSpinner3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,13 @@ public void setCurrentYear(int currentYear) {
if (!explicitStartYear && startYear > currentYear) {
startYear = currentYear;
}
if (!explicitEndYear && endYear -1 < currentYear) {
endYear = currentYear+1;
if (!explicitEndYear && endYear < currentYear) {
endYear = currentYear;
}
if (currentYear < startYear) {
throw new IllegalArgumentException("Current year "+currentYear+" before start year "+startYear);
}
if (currentYear > endYear - 1) {
if (currentYear > endYear) {
throw new IllegalArgumentException("Current year "+currentYear+" after end year "+endYear);
}
if(year != null) {
Expand All @@ -433,13 +433,13 @@ public void setCurrentDay(int currentDay) {
if (!explicitStartDay && startDay > currentDay) {
startDay = currentDay;
}
if (!explicitEndDay && endDay -1 < currentDay) {
endDay = currentDay + 1;
if (!explicitEndDay && endDay < currentDay) {
endDay = currentDay;
}
if (startDay > currentDay) {
throw new IllegalArgumentException("Start day "+startDay+" after current day "+currentDay);
}
if (endDay -1 < currentDay) {
if (endDay < currentDay) {
throw new IllegalArgumentException("End day "+endDay+" before current day "+currentDay);
}
if(day != null) {
Expand All @@ -466,13 +466,13 @@ public void setCurrentMonth(int currentMonth) {
if (!explicitStartMonth && startMonth > currentMonth) {
startMonth = currentMonth;
}
if (!explicitEndMonth && endMonth -1 < currentMonth) {
endMonth = currentMonth+1;
if (!explicitEndMonth && endMonth < currentMonth) {
endMonth = currentMonth;
}
if (startMonth > currentMonth) {
throw new IllegalArgumentException("Start month "+startMonth+" after current month "+currentMonth);
}
if (endMonth -1 < currentMonth) {
if (endMonth < currentMonth) {
throw new IllegalArgumentException("End month "+endMonth+" before current month "+currentMonth);
}
if(month != null) {
Expand Down

0 comments on commit 1ef5fff

Please sign in to comment.