Skip to content
Snippets Groups Projects
Commit 63b48929 authored by Dennis Eisold's avatar Dennis Eisold
Browse files

Fixed error in addiereTage

parent 2b7043f6
No related branches found
No related tags found
No related merge requests found
Pipeline #121 failed with stage
in 14 seconds
......@@ -234,20 +234,30 @@ public class Datum {
long neuerTag = this.getTag() + iTage;
if (neuerTag > this.getMonthDays(this.getMonat())) {
do {
this.addiereMonate(neuerTag / this.getMonthDays(this.getMonat()));
neuerTag -= this.getMonthDays(this.getMonat());
} while (neuerTag / this.getMonthDays(this.getMonat()) < 1);
neuerTag = neuerTag - this.getMonthDays(this.getMonat());
this.addiereMonate(1);
} while (neuerTag > this.getMonthDays(this.getMonat()));
this.setTag(neuerTag % this.getMonthDays(this.getMonat()));
} else if (neuerTag <= 0) {
do {
this.addiereMonate(neuerTag / this.getMonthDays(this.getMonat()) - 1);
neuerTag -= this.getMonthDays(this.getMonat());
} while(neuerTag / this.getMonthDays(this.getMonat()) < 1);
this.setTag(this.getMonthDays(this.getMonat()) + neuerTag % this.getMonthDays(this.getMonat()));
} else {
}
else if (iTage < 0) {
neuerTag = this.getTag() + iTage;
long nextMonth = (this.getMonthDays(this.getMonat()) * -1);
while(neuerTag <= nextMonth) {
this.addiereMonate(- 1);
neuerTag = neuerTag + this.getMonthDays(this.getMonat());
nextMonth = (this.getMonthDays(this.getMonat() - 1) * -1);
}
this.addiereMonate(- 1);
this.setTag( this.getMonthDays(this.getMonat()) + neuerTag);
} else if(iTage != 0) {
this.setTag(neuerTag);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment