What is the motivation for two different week-based-year definitions in JSR-310?

后端 未结 1 1399
你的背包
你的背包 2020-12-03 21:22

These are the two fields in the package java.time.temporal:

IsoFields.WEEK_BASED_YEAR

WeekFields.ISO.weekBasedYear()

ISO-8601 defines a

相关标签:
1条回答
  • 2020-12-03 22:07

    This is a bug in IsoFields which managed to slip through because this method was untested (sorry about that). There should be very little observable difference between IsoFields and WeekFields.ISO when implemented correctly.

    See the bug report and patch which will eventually work through the system and be fixed.

    Note, testing revealed that getting the field is fine, the bug only affected the with/adjustInto method of WEEK_BASED_YEAR. The unit WEEK_BASED_YEARS is affected because the addition is implemented internally by reusing the broken WEEK_BASED_YEAR.

    Update 2014-08-28: This was one of 14 java.time bugs fixed in 8u20.

    0 讨论(0)
提交回复
热议问题