News for hackers. Stuff that matters.
Re:Do not use 'week year': YYYY by cies on Tuesday January 04, 2022 @08:33AM (#29794484)
It's harder to make that bug. The common case is "year of era", so it is likely to be used for "year()".

On the other hand the much less often used "year of week" would be named "year_of_week()" and hence it is clear to everyone that's not likely what you want.

Re:Do not use 'week year': YYYY by nicoburns on Tuesday January 04, 2022 @08:41AM (#29794572)
> It's harder to make that bug. The common case is "year of era", so it is likely to be used for "year()".

That would be the sane thing to do. But the same applies to `YYYY`: it should be used for "year of era". But it hasn't been and that's the problem here. For contrast in moment.js, YYYY and yyyy do what you expect and "week year" is GGGG or gggg.

Re:Do not use 'week year': YYYY by masklinn on Tuesday January 04, 2022 @09:43AM (#29795251)
> That would be the sane thing to do. But the same applies to `YYYY`: it should be used for "year of era".

Why? `yyyy` is simpler to type, so makes a lot more sense for "year of era".

> For contrast in moment.js, YYYY and yyyy do what you expect and "week year" is GGGG or gggg.

In LDML (which I assume is what SimpleDateFormat uses), the G field is already spoken for the era name (BC/BCE and AD/CE).