Lire::WeekCalculator(3pm)

Lire::WeekCalculator3pm

Handle different weeknumbering schemes

Usage

    use Lire::WeekCalculator;
    my $week_calc = new Lire::WeekCalculator();
    my $week_no   = $week_calc->week_number( $time );

Overview

We support three values for LR_WEEK_NUMBERING: ISO (strftime's %V): week starts on monday; W (week starts on monday) and U (week starts on sunday). See strftime(1).

Constructor

new( %params )

Creates a new week calculator. The style of week numbering is selected using the "style" parameter. If that parameter is omitted, it defaults to the style set in 'lr_week_numbering' configuration variable.

style()

Returns the week numbering style used. This will be either "U", "W" or "ISO".

week_number( $time )

Returns the week number of $time according the current week numbering scheme. The week number returned is between 1 and 53.

week_idx( $time )

Returns the week index of $time according to the week numbering scheme. The week index is Lire specific and is used to normalise computations between different scheme in regards of the first incomplete week of the year. In the ISO case, the week index is always equals to week_number() - 1, for the other style, the week index of the week 0 will be one less than the last week number of the previous year.

last_week_of_year($year)

Returns the week number of the last week in the year $year.

week_start( $year, $week_no )

Returns the epoch time of the first day of week $week_no in year $year when calculated using current style.

find_year_week1_start_date($year)

Returns the date (epoch) at which the first day of the first week of the year $year starts.

strformat()

Returns a string that can be used as the format specificier in calls to strftime to print the week number of this style.

strfdate()

Emulates POSIX::strftime() but picks up the %V if the system strftime doesn't support it. Should be called whenever you use format strings that may contain week-of-the-year-codes.

Version

$Id: WeekCalculator.pm,v 1.16 2006/07/23 13:16:30 vanbaal Exp $

Releases

6 releases since Debian 3.1 (Sarge); the text changed 5 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. Arch

Authors

  Joost van Baal <[email protected]>,
  Francis J. Lacoste <[email protected]>,
  Wessel Dankers <[email protected]>

From lire 2.1.1-8 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.