On Fri, 24 Jan 2003, Dave Rolsky wrote: > On Fri, 24 Jan 2003, Peter J. Acklam wrote: > > In relation to week numbers and day of week numbers, there are > > at least four parameters that must be customizable: > > > > 1) What is the first day of a week (Sunday, Monday, ...)? > > I just need method names for this. Monday as first day of week is > "day_of_week" (Monday is 1) and "day_of_week_0" (Monday is 0). Equivalent > methods using Sunday are welcome, but they need good names.
So if I want to use Sunday as the first day of the week every will method I use will have "sunday" in it? What if for some business reason I decide that it's easier to do my calculations if Wednesday is the first day of the week? How about: use DateTime; use DateTime::Lingua::EN; use DateTime::Lingua::FR; DateTime::first_day_of_week( DateTime::Lingua::EN::SUNDAY ); or maybe we can make english the "blessed default language like we are doing for the Gragorian Calendar" DateTime::first_day_of_week( SUNDAY ); # Exported Constant? DateTime::first_day_of_week( DateTime::Lingua::EN::DIMANCHE ); And then use the '_0' methods as desired if you want a 0 based index I'd prefer the above plus $d->weekday_num_0 over $d->weekday_num_sunday_0; $d->weekday_num_wednesday_0; > > 3) How many days of a week must be in the new year before > > the week is considered the first week in the new year? > > (ISO: 4, US: 1 and 7) > > Eek, I'm not sure I want to touch this yet. But if people have good mehod > names, I'm happy to include it. DateTime::min_days_first_week_of_year(7) If it's a Class value and is object overridable ... Clayton