-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
Description
In java.time week of weekbased year is depending on Locale. The locale we use is ROOT, and it does not define the start of the week.
Therefore start of the week can be either Sunday or Monday.
ISO 8601 defines start of the week as Monday, and that standard was used in Joda for week of week based year.
This would fail because of that change.
2019-21 (ok joda) vs 2019-22 (java)
ZonedDateTime now = LocalDateTime.of(2019,5,26,1,32,8,328402)
.atZone(ZoneOffset.UTC);
DateFormatter jodaFormatter = Joda.forPattern("xxxx-ww").withLocale(Locale.ROOT).withZone(ZoneOffset.UTC);
DateFormatter javaFormatter = DateFormatter.forPattern("8YYYY-ww").withLocale(Locale.ROOT).withZone(ZoneOffset.UTC);
assertThat(jodaFormatter.format(now), equalTo(javaFormatter.format(now)));