Boost logo

Boost :

From: Kostya Altukhov (kostya_at_[hidden])
Date: 2003-03-21 12:21:29


I read on the date_time change history about a new function for
calculating ISO 8601 week number.

I should note that this week number is rather useless without
the corresponding year number. ISO 8601 week-based year is not
always the same as the actual year. For example, 2nd January 1999
is week 53 of year 1998 (not 1999!). 30th December 1997 is week
01 of year 1998 (not 1997!). (examples taken from the C99 standard)

My experience is that people often forget about this important fact
and thus introduce bugs that may be not be catched until such situation
really happens in life. To force library users consider this thing,
I think that gregorian::date::week_number should return a pair: week
number and week-based year number.

Another option would be to just add a separate function for calculating
week-based year number, however in my opinion it is less desirable
because of reasons mentined above. In any case, providing week number
without providing week-based year number is undesirable.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk