Week of the year aggregation

Hi guys,

I'm trying to get the week of the years using a painless script (below)

def date = ZonedDateTime.ofInstant(Instant.ofEpochMilli(doc['DATE_FIELD'].value.millis), ZoneId.of(UTC)); 
DayOfWeek dayOfWeek = DayOfWeek.valueOf('MONDAY');
date = date.with(TemporalAdjusters.previousOrSame(dayOfWeek)).plusWeeks(1); 
return date.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);

Expected result for Week 35 is these dates 27th August - 2 September
Current result for Week 35 (see screenshot) is these dates 20th August - 26 August

Any idea what I might be missing here?

Cheers

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.