From 8b9ee5a4eb7ac8dd17b95e18defcffd6d0aad883 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:13:58 +0100 Subject: [PATCH] fixed files form Time #14 --- .../org/joda/time/chrono/BasicMonthOfYearDateTimeField.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/Time/14/org/joda/time/chrono/BasicMonthOfYearDateTimeField.java b/projects/Time/14/org/joda/time/chrono/BasicMonthOfYearDateTimeField.java index afca44e..2892a2d 100644 --- a/projects/Time/14/org/joda/time/chrono/BasicMonthOfYearDateTimeField.java +++ b/projects/Time/14/org/joda/time/chrono/BasicMonthOfYearDateTimeField.java @@ -206,7 +206,12 @@ public int[] add(ReadablePartial partial, int fieldIndex, int[] values, int valu if (valueToAdd == 0) { return values; } + if (partial.size() > 0 && partial.getFieldType(0).equals(DateTimeFieldType.monthOfYear()) && fieldIndex == 0) { // month is largest field and being added to, such as month-day + int curMonth0 = partial.getValue(0) - 1; + int newMonth = ((curMonth0 + (valueToAdd % 12) + 12) % 12) + 1; + return set(partial, 0, values, newMonth); + } if (DateTimeUtils.isContiguous(partial)) { long instant = 0L; for (int i = 0, isize = partial.size(); i < isize; i++) {