Bug #72719 [Dup->Ver]: Relative datetime format ignores weekday on sundays only
| From: | requinix@php.net | Date: | Mon, 01 Aug 2016 14:13:19 +0000 |
| Subject: | Bug #72719 [Dup->Ver]: Relative datetime format ignores weekday on sundays only | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202803@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72719&edit=1
ID: 72719
Updated by: requinix@php.net
Reported by: filip at prochazka dot su
Summary: Relative datetime format ignores weekday on sundays
only
-Status: Duplicate
+Status: Verified
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 7.1.0beta1
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
No, you're right: this is a bug. I got hung up on the Sunday/Monday week issue and missed the
different result seen only on Sundays.
Old behavior (pre-PHP 5.6.23/7.0.8), Sunday and Monday were considered part of the same week but
Monday was the start of the week. This was clearly a bug (bug #63740). New behavior is that Sunday
and Monday are in different weeks. https://3v4l.org/nXoDJ
However it appears that the fix introduced what you're seeing now. On a Sunday, "$dayname
$reltext week" effectively ignores the $dayname.
https://3v4l.org/qv8vI - Sunday behaves differently than the
rest of the week
https://3v4l.org/XtSCi - no difference between "$dayname
next week" and "next week $dayname"
https://3v4l.org/fmCoi - unsurprisingly, "this week"
has the same problem
Previous Comments:
------------------------------------------------------------------------
[2016-08-01 08:07:36] filip at prochazka dot su
Also, I think you've overlooked an important detail. The provided code is broken on every
Sunday, but for example today, it's working according to my expectation :)
This inconsistency is a big problem, since you can write something at Tuesday and it works, so you
deploy it at Friday and on Sunday it breaks.
------------------------------------------------------------------------
[2016-07-31 10:48:29] filip at prochazka dot su
Thanks Damian, didn't find that one :-/
Anyway, I don't like that it's closed, as this broke BC in patch version. Would be
acceptable in 7.1, but look at the versions in the actual output. I'm pretty sure that's
wrong.
------------------------------------------------------------------------
[2016-07-31 10:45:31] filip at prochazka dot su
Fixed the title, as the preview function on bugs.php.net is buggy and reset's it when you click
edit the preview :-/
------------------------------------------------------------------------
[2016-07-31 10:18:37] requinix@php.net
Take a look at bug #72514.
------------------------------------------------------------------------
[2016-07-31 10:14:01] filip at prochazka dot su
Description:
------------
https://3v4l.org/hrZsA
It works as expected at monday to saturday. But on sunday, it always returns monday no matter what
weekday you give it, except sunday, that one works.
Test script:
---------------
var_dump(new DateTimeImmutable('Monday next week 13:00'));
var_dump(new DateTimeImmutable('Tuesday next week 14:00'));
var_dump(new DateTimeImmutable('Wednesday next week 14:00'));
var_dump(new DateTimeImmutable('Thursday next week 15:00'));
var_dump(new DateTimeImmutable('Friday next week 16:00'));
var_dump(new DateTimeImmutable('Saturday next week 17:00'));
var_dump(new DateTimeImmutable('Sunday next week 18:00'));
Expected result:
----------------
2016-08-08 13:00:00
2016-08-09 14:00:00
2016-08-10 14:00:00
2016-08-11 15:00:00
2016-08-12 16:00:00
2016-08-13 17:00:00
2016-08-14 18:00:00
Actual result:
--------------
Output for 5.6.23 - 5.6.24, 7.0.8 - 7.1.0beta1
2016-08-01 13:00:00
2016-08-01 14:00:00
2016-08-01 14:00:00
2016-08-01 15:00:00
2016-08-01 16:00:00
2016-08-01 17:00:00
2016-08-07 18:00:00
Output for 5.6.0 - 5.6.22, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.7
2016-08-08 13:00:00
2016-08-09 14:00:00
2016-08-10 14:00:00
2016-08-11 15:00:00
2016-08-12 16:00:00
2016-08-13 17:00:00
2016-08-14 18:00:00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72719&edit=1