Skip to content

Bug report - erroneous week %U and year %L numbers in printf #52

@adam-allgood

Description

@adam-allgood

Date::Manip::Date is returning erroneous values for the week of the year and the year as we progress from the end of 2025 into 2026. To reproduce the error, I used the following short script (after a clean install of Date::Manip::Date using cpanm into a directory called cpan in the same location as the test script):

#!/usr/bin/env perl

use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/cpan/lib/perl5";
use Date::Manip::Date;

my $day1 = Date::Manip::Date->new();
$day1->parse("December 28, 2025");
my $day2 = Date::Manip::Date->new();
$day2->parse("January 4, 2026");
print $day1->printf("day1 is %a %Y-%m-%d\n");
print $day1->printf("day1 is week %U of year %L\n");
print $day2->printf("day2 is %a %Y-%m-%d\n");
print $day2->printf("day2 is week %U of year %L\n");

exit 0;

The results of running this script are:

day1 is Sun 2025-12-28
day1 is week 01 of year 2026
day2 is Sun 2026-01-04
day2 is week 01 of year 2026

This is incorrect, as Sun 2025-12-28 should be in week 52 of 2025.

I have tested this on systems running Debian 13 (perl v5.40.1) and RHEL8 (perl v5.26.3). The Date::Manip::Date version from CPAN is 6.98.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions