Re: glib1.3.5 : g_date_xxxx_week_of_year



Havoc Pennington a écrit :
> 
> GHF <jean-noel guiheneuf wanadoo fr> writes:
> >
> > The g_date_get_sunday_week_of_year routine returns 0 if the day is
> > before the first Sunday of the year.
> > The g_date_get_monday_week_of_year routine returns 0 if the day is
> > before the first Monday of the year.
> >
> > But the ISO 8601 rule is : The first week of the year is the week
> > containing the first Thursday.
> >
> > See : http://personal.ecu.edu/mccartyr/aboutwdc.htm
> >
> 
> I believe that what the ISO spec says is "you should use thursday
> weeks", while these functions implement sunday weeks and monday weeks.
> i.e. your behavior would be right for
> g_date_get_thursday_week_of_year().
> 
> Though at that point, maybe g_date_get_week_of_year() taking a day of
> the week argument would be appropriate.
> 
> Havoc

I think you are wrong ...

Thursday doesn't define the beginning of the weeks but the first week of
the year (which is different if the week starts on Sunday or on Monday).

The glib1.3.5 routines are not in accordance with the weeks of the
gtkcalendar widget ...

Here is a small program with 2 adapted routines which tests the
glib1.3.5 routines and the adapted routines.

The adapted routines can return the week of the first and the last days
of a year.

Regards

Attachment: test_date.c.tar.gz
Description: GNU Zip compressed data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]