[wp-trac] [WordPress Trac] #54132: Function calendar_week_mod should depends on week_begins
WordPress Trac
noreply at wordpress.org
Wed Nov 24 10:13:43 UTC 2021
#54132: Function calendar_week_mod should depends on week_begins
-------------------------------+------------------------------
Reporter: voregnev | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version:
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by voregnev):
I found that the action of this function is related to the setting of the
timezone on the hosting.
for example, run the following code
{{{#!php
echo "\nTZ:".date_default_timezone_get()."\n";
$week_begins = 1;
$thismonth =11;
$thisyear = 2021;
$unixmonth = mktime( 0, 0, 0, $thismonth, 1, $thisyear );
$last_day = gmdate( 't', $unixmonth );
echo "GMUNIXMONTH".gmdate('d.m.Y',$unixmonth)."\n";
echo "UNIXMONTH".date('d.m.Y',$unixmonth)."\n";
echo "LASTDAY".$last_day."\n";
$dwgm = gmdate( 'w', $unixmonth );
echo "DW-GM".$dwgm;
echo "\nPAD-gm".calendar_week_mod($dwgm - $week_begins)."\n";
$dwd = date( 'w', $unixmonth );
echo "DW-DATE".$dwd;
echo "\nPAD-DATE".calendar_week_mod($dwd -
$week_begins)."\n";
}}}
My output:
TZ:Europe/Moscow (GMT+3)
GMUNIXMONTH31.10.2021
UNIXMONTH01.11.2021
LASTDAY31
DW-GM0
PAD-gm6
DW-DATE1
PAD-DATE0
Seems we need use date instead gmdate for getting right pad
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54132#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list