fili icon indicating copy to clipboard operation
fili copied to clipboard

Bug: Week of Year set on sql code doesn't correctly resolve dates.

Open michael-mclawhorn opened this issue 4 years ago • 0 comments

When setting year and then weekOfYear, the results reset to a prior year on years where first week of year starts in the previous calendar year. This is probably a joda bug.

`import org.joda.time.DateTimeField import org.joda.time.DateTimeFieldType import org.joda.time.DateTimeZone import org.joda.time.MutableDateTime

MutableDateTime mutableDateTime1 = new MutableDateTime(0, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC) mutableDateTime1.set(DateTimeFieldType.year(), 2021) mutableDateTime1.set(DateTimeFieldType.weekOfWeekyear(), 49) mutableDateTime1.setDayOfWeek(1) println(mutableDateTime1.toString())

MutableDateTime mutableDateTime2 = new MutableDateTime(0, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC) mutableDateTime2.set(DateTimeFieldType.weekOfWeekyear(), 49) mutableDateTime2.set(DateTimeFieldType.year(), 2021) mutableDateTime2.setDayOfWeek(1) println(mutableDateTime2.toString()) `

2020-11-30T00:00:00.000Z 2021-12-06T00:00:00.000Z

michael-mclawhorn avatar Dec 15 '21 16:12 michael-mclawhorn