in reply to Re^4: Baffled by DateTime
in thread Baffled by DateTime

I have v. 1.54, installed 12/04/20. And its docs say
$day = $dt->day; # 1-31 $dow = $dt->day_of_week; # 1-7 (Monday is 1) $hour = $dt->hour; # 0-23 $minute = $dt->minute; # 0-59
and I checked about an old version and cpan tells me
cpan: upgrade all Fetching with LWP: http://cpan.strawberryperl.com/authors/01mailrc.txt.gz Fetching with LWP: http://cpan.strawberryperl.com/modules/02packages.details.txt.gz Fetching with LWP: http://cpan.strawberryperl.com/modules/03modlist.data.gz Database was generated on Thu, 30 Mar 2023 14:21:05 GMT Updating database file ... Done! All modules are up to date for all
so I don't know why my version is different than yours.

Replies are listed 'Best First'.
Re^6: Baffled by DateTime
by pryrt (Abbot) on Mar 31, 2023 at 18:10 UTC
    DateTime is at 1.59 since 2022-10-23. Because you have cpan set to use strawberryperl's mirror, even though CPAN mirrors aren't recommended since the central server handles loadbalancing now, you are relying on strawberryperl being up-to-date; given that they haven't released a new version of perl since 2021, expecting their cpan-mirror to be more up-to-date than their perl version is a bit optimistic. I always use cpanm client from strawberryperl, without overriding to any mirrors, and it has no problem deciding it's time to update DateTime.

    But even in v1.54's documentation, the local_day_of_week documentation matches hippo's quote. You are quoting from the SYNOPSIS, and are quoting an example of day_of_week() even though your original code used local_day_of_week(), which is a different function with different return values.