When grilled further on (Sun, 13 Mar 2005 19:40:02 +0100),
Kurt Roeckx <kurt@roeckx.be> confessed:
> > Attached is a patch against HEAD for your review.
>
> It has this comment in it:
> /* the new year cannot be greater than the
> * original year, so we subtract one if it is
>
Not doing to well here. When will the ISO year be greater than the current
year? But, what I did is incorrect and 2006-01-01 shows the next problem date:
SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp '2006-01-01' ) AS
week_trunc;
date_trunc_week | week_trunc
-----------------+--------------------- | 2006-12-25 00:00:00
Heck, even what I submitted, test and all is wrong:
SELECT '' AS date_trunc_week, date_trunc( 'week', timestamp '2005-01-01' ) AS
week_trunc;date_trunc_week | week_trunc
-----------------+--------------------- | 2005-01-02 00:00:00
The date should be 2005-01-03. Sigh. Maybe I should of just submitted a bug
report about it...
So, unless someone else knows how to do this correctly, I'll have to actually
think about it.
Cheers,
Rob
-- 12:34:02 up 47 days, 17:50, 4 users, load average: 2.34, 2.60, 2.55
Linux 2.6.5-02 #8 SMP Mon Jul 12 21:34:44 MDT 2004