Date firstOfJanuary = new Date(nearestThursday.getYear(), 0, 1);
long timeDiff = nearestThursday.getTime() - firstOfJanuary.getTime();
- int daysSinceFirstOfJanuary = (int) (timeDiff / MILLISECONDS_PER_DAY);
+
+ // Rounding the result, as the division doesn't result in an integer
+ // when the given date is inside daylight saving time period.
+ int daysSinceFirstOfJanuary = (int) Math.round((double) timeDiff
+ / MILLISECONDS_PER_DAY);
int weekNumber = (daysSinceFirstOfJanuary) / 7 + 1;
isoWeekNumbers.put(getDate(2010, 1, 4), 1);
isoWeekNumbers.put(getDate(2010, 1, 5), 1);
isoWeekNumbers.put(getDate(2010, 10, 10), 40);
+ isoWeekNumbers.put(getDate(2015, 3, 24), 13);
+ isoWeekNumbers.put(getDate(2015, 3, 31), 14);
+ isoWeekNumbers.put(getDate(2015, 10, 13), 42);
+ isoWeekNumbers.put(getDate(2015, 10, 20), 43);
+ isoWeekNumbers.put(getDate(2015, 10, 27), 44);
+ isoWeekNumbers.put(getDate(2026, 3, 24), 13);
+ isoWeekNumbers.put(getDate(2026, 3, 31), 14);
+ isoWeekNumbers.put(getDate(2026, 10, 13), 42);
+ isoWeekNumbers.put(getDate(2026, 10, 20), 43);
+ isoWeekNumbers.put(getDate(2026, 10, 27), 44);
}