RFR: 8247781: Day periods support [v7]

Stephen Colebourne scolebourne at openjdk.java.net
Thu Nov 5 23:51:59 UTC 2020


On Mon, 2 Nov 2020 23:21:22 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Pulling on this a little more.
>> 
>> As the PR stands, it seems that if the user passes in text with just a day-period of "AM" they get a `LocalTime` of 06:00 but if they pass in `AMPM_OF_DAY` of "AM" the get no `LocalTime` in the result. Is that right? If so, I don't think this is sustainable.
>> 
>> Thats why I think `AMPM_OF_DAY` will have to be resolved to a dayPeriod of "am" or "pm". If dayPeriod is more precise than `AMPM_OF_DAY`, then dayPeriod can silently take precedence
>
> I implemented what you suggested here in the latest PR, but that would be a behavioral change which requires a CSR, as "AM" would be resolved to 06:00 which was not before. Do you think it would be acceptable? If so, I will reopen the CSR and describe the change. (In fact some TCK failed with this impl)

I find the whole "half way between the start and end" behaviour of day periods odd anyway, but if it is to be supported then it should be consistent as you've implemented. 

Another option I should have thought of earlier would be to simply not support the "half way between the start and end" behaviour of LDML in either dayPeriod or AM/PM. But since LDML defines it, you've implemented it, and it isn't overly harmful I think its OK to leave it in.

Would it be possible for STRICT mode to not have the "half way between the start and end" behaviour?

-------------

PR: https://git.openjdk.java.net/jdk/pull/938


More information about the core-libs-dev mailing list