3 ms·
In Postgres `extract(week from t)` has a similar danger. If you combine it with `extract(year from t)` then you land in the wrong place. You need to combine it
by pjungwir 8y ago
In Postgres `extract(week from t)` has a similar danger. If you combine it with `extract(year from t)` then you land in the wrong place. You need to combine it with `extract(isoyear from t)` instead. That bug is sort of the opposite of this one: instead of parsing a date and using the ISO year by mistake, it's formatting a date and omitting the ISO year by mistake.
- naniwaduni 8y agoThis seems substantially less likely to be a problem since (a) G-V-u is relatively rare compared to Y-m-d (b) The choice-of-year problem is inherent to week-based dates, but not to month-based dates, since years are not week-aligned, so knowing the difference is table stakes for implementors of week-based timestamps Now, "isoyear" seems like an awful name in various ways, not least of which is people seeing "iso" and assuming that this is what they really want (i.e. the same problem all over again)...