I was just proposing an alias for "week" it that clarifies what it is
the week *of*.  The rest of what you ask is already established in
Temporal.pm.

1.  week returns the week number in the ISO 8601 week calendar.  You
can find the spec by Googling, but in summary:
   a. weeks begin on Monday
   b. weeks are numbered 1 to 52 or 53
   c. week 1 is the first week containing at least four days of the
new calendar year

2. week-year returns the year number, based on boundaries defined by
the above principle.  For instance, week 1 of this year began on
January 4th, 2010, so on January 3rd, 2010, "week-year" would still
return 2009.

These are the same values returned by the %V and %G strftime(3)
conversion specifications, e.g. date +%GW%V on Unixlike systems.


>> By analogy, I'd say week-of-year should work as well.
>
> Oof, is there a generally accepted for numbering weeks within a year?
> A month's boundaries' always coincides with a day's boundary, but a
> year only occasionally begins/ends on a week boundary. Come to think
> of it, there isn't even consensus on what day of the week constitutes
> a week start, even if Perl 6 has chosen a convention.
>
> On the other hand, I won't complain about a "week-of-year" with a good
> definition of how it handles weeks 0/1, 52/53. End user can choose to
> use it or not. And I'm not too anxious to open up the whole calendar
> choice can of worms.
>



-- 
Mark J. Reed <markjr...@gmail.com>

Reply via email to