WeekCalculator(3pm)
πΈ WeekCalculator(3pm) β Lire::WeekCalculator πΈ
okay so this is a page straight out of LogReport's Lire Documentation, and it's literally all about week numbering schemes. yes, week numbers. it's more iconic than it sounds, i promise π
β¨ NAME β¨
Lire::WeekCalculator β the module that handles all the different weeknumbering schemes, no cap ποΈ
π SYNOPSIS π
use Lire::WeekCalculator;
my $week_calc = new Lire::WeekCalculator();
my $week_no = $week_calc->week_number( $time );
that's the whole vibe: you make one, you ask it for a week number. slay.
π¦ DESCRIPTION π¦
bestie, we support three values for LR_WEEK_NUMBERING, and you gotta know all of them:
ISOβ this is the one fromstrftime's%V. week starts on monday π«ΆWβ week starts on mondayUβ week starts on sunday
see strftime(1) for the receipts. π
π CONSTRUCTOR π
π new( %params ) π
creates a fresh new week calculator, main character energy only. the style of week numbering is picked with the "style" parameter. if you forget that parameter (it happens, no judgement), it defaults to whatever style is set in the 'lr_week_numbering' configuration variable. π
π style() π
returns the week numbering style in use. it'll be either "U", "W" or "ISO". that's it, that's the whole function π
π week_number( $time ) π
returns the week number of $time according to the current week numbering scheme. the week number it hands back is between 1 and 53. yes, 53. some years are just extra like that π
π week_idx( $time ) π
returns the week index of $time according to the week numbering scheme. and listen, the week index is Lire specific β it exists to normalise computations between different schemes in regards of the first incomplete week of the year. sounds intense, but here's the tea:
- in the
ISOcase, the week index is always equals toweek_number()- 1 - for the other styles, the week index of the week
0will be one less than the last week number of the previous year
it's giving "edge case but make it fashion" β¨
π last_week_of_year($year) π
returns the week number of the last week in the year $year. final week, final boss π
π week_start( $year, $week_no ) π
returns the epoch time of the first day of week $week_no in year $year, calculated using the current style. epoch time!!! so vintage of it π°οΈ
π find_year_week1_start_date($year) π
returns the date (epoch) at which the first day of the first week of the year $year starts. like, where does week 1 even begin, you know? π
π strformat() π
returns a string you can use as the format specificier in calls to strftime to print the week number of this style. (yes, the original really spells it "specificier" β we keep the lore intact π)
π 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. lowkey your safety net π«Ά
honestly, if your format string has week-of-the-year codes in it, just call strfdate(). trust. π
π AUTHORS π
the icons who made this happen:
- Joost van Baal <joostvb@logreport.org>
- Francis J. Lacoste <flacoste@logreport.org>
- Wessel Dankers <wsl@logreport.org>
periodt. π
β VERSION β
$Id: WeekCalculator.pm,v 1.16 2006/07/23 13:16:30 vanbaal Exp $
a whole entire version string, frozen in time like a little time capsule π
π COPYRIGHT π
Copyright (C) 2002 Stichting LogReport Foundation LogReport@LogReport.org
This file is part of Lire.
Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html.
not me reminding you that "without even the implied warranty" means no promises, bestie β read the license fr fr π
πΈ okay that's the whole page!! this was Lire 2.1.1, dated 2025-09-28, and it's the WeekCalculator(3pm) page β go forth and number your weeks correctly, queen πβ¨π¦
π¦ where this page comes from
- arch rolling: lire 2.1.1-8 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms