Bug #75477 [NEW]: last weekday of this month returns previous month when date is set
| From: | wouter at deinternetjongens dot nl | Date: | Fri, 03 Nov 2017 10:38:36 +0000 |
| Subject: | Bug #75477 [NEW]: last weekday of this month returns previous month when date is set | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-212420@lists.php.net to get a copy of this message | ||
From: wouter at deinternetjongens dot nl
Operating system: Linux, mac os
PHP version: 7.1.11
Package: Date/time related
Bug Type: Bug
Bug description:last weekday of this month returns previous month when date is set
Description:
------------
We came across a
bug when trying to get the last weekday of a month.
When we first setted a new date and afterwards modified it to get the
last weekday of that month it returns the last weekday of the month
before the month given.
Test script:
---------------
$datetime = new DateTime()->setDate(2017, 12, 1);
var_dump($datetime->modify('last weekday this month');
Expected result:
----------------
DateTime {#12086
+"date": "2017-12-30 00:00:00.000000",
+"timezone_type": 3,
+"timezone": "UTC",
}
Actual result:
--------------
DateTime {#12086
+"date": "2017-11-30 00:00:00.000000",
+"timezone_type": 3,
+"timezone": "UTC",
}
--
Edit bug report at https://bugs.php.net/bug.php?id=75477&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75477&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75477&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75477&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75477&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75477&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75477&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75477&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75477&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75477&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75477&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75477&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75477&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75477&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75477&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75477&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75477&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75477&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75477&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75477&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75477&r=mysqlcfg