Skip to content

feat: add %V format code for ISO 8601 week number#128

Merged
atoomic merged 1 commit into
cpan-authors:mainfrom
Koan-Bot:koan.atoomic/add-iso-week-format
Apr 29, 2026
Merged

feat: add %V format code for ISO 8601 week number#128
atoomic merged 1 commit into
cpan-authors:mainfrom
Koan-Bot:koan.atoomic/add-iso-week-format

Conversation

@Koan-Bot
Copy link
Copy Markdown

@Koan-Bot Koan-Bot commented Apr 28, 2026

What

Add %V — ISO 8601 week number (01-53) — to the strftime/time2str format codes.

Why

%V is a standard POSIX strftime code that was missing from TimeDate. ISO week numbering is widely used in European business contexts, logistics, and project planning. Without it, users had to compute the ISO week number manually.

How

New format_V() in Date::Format::Generic using the Thursday-based ISO 8601 algorithm. Handles the tricky year-boundary cases:

  • Early January dates that belong to the previous year's last week (52 or 53)
  • Late December dates that belong to week 1 of the next year

Testing

t/iso-week-number.t with 18 test cases covering:

  • Regular weeks, year boundaries, leap years
  • Years starting on every day of the week (2015=Thu, 2016=Fri, 2023=Sun, 2024=Mon, 2026=Thu)
  • 53-week years (2004, 2015)

🤖 Generated with Claude Code


Quality Report

Changes: 3 files changed, 75 insertions(+)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

Add format_V() implementing ISO 8601 week numbering (01-53), where
week 1 contains the year's first Thursday and weeks start on Monday.

Handles year-boundary edge cases: dates in early January that belong
to the previous year's last week (52 or 53), and late December dates
that belong to week 1 of the next year.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@atoomic atoomic marked this pull request as ready for review April 29, 2026 09:36
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@atoomic atoomic merged commit 28ffbf1 into cpan-authors:main Apr 29, 2026
22 checks passed
@Koan-Bot Koan-Bot deleted the koan.atoomic/add-iso-week-format branch April 29, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants