Browse Source
- MFH: Fixed weekdays adding/subtracting algorithm.
- MFH: Fixed weekdays adding/subtracting algorithm.
- MFH: Fixed some ambiguities in the date parser. - MFH: Fixed bug #45529 (new DateTimeZone() and date_create()->getTimezone() behave different). - MFH: Fixed bug #43452 (strings containing a weekday, or a number plus weekday behaved incorrect of the current day-of-week was the same as the one in the phrase). - MFH: Fixed a bug with the YYYY-MM format not resetting the day correctly. - MFH: Fixed a bug in the DateTime->modify() methods, it would not use the advanced relative time strings. - MFH: Fixed a segfault - simply a forgotten return;PHP-5.2.1RC1
10 changed files with 18429 additions and 18311 deletions
-
11NEWS
-
36553ext/date/lib/parse_date.c
-
15ext/date/lib/parse_date.re
-
2ext/date/lib/parse_tz.c
-
47ext/date/lib/tm2unixtime.c
-
16ext/date/lib/unixtime2tm.c
-
9ext/date/php_date.c
-
71ext/date/tests/bug43452.phpt
-
4ext/date/tests/date_parse_001.phpt
-
12ext/date/tests/strtotime_basic.phpt
36553
ext/date/lib/parse_date.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,71 @@ |
|||
--TEST-- |
|||
Bug #43452 ("weekday" is not equivalent to "1 weekday" of the current weekday is "weekday") |
|||
--INI-- |
|||
date.timezone=Europe/Oslo |
|||
--FILE-- |
|||
<?php |
|||
// <day> is equivalent to 1 <day> and will *not* forward if the current day |
|||
// (November 1st) is the same day of week. |
|||
$day = strtotime( "Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "1 Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "2 Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "3 Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n\n"; |
|||
|
|||
// forward one week, then behaves like above for week days |
|||
$day = strtotime( "Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "+1 week Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "+2 week Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "+3 week Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n\n"; |
|||
|
|||
// First, second, etc skip to the first/second weekday *after* the current day. |
|||
// This makes "first thursday" equivalent to "+1 week thursday" - but only |
|||
// if the current day-of-week is the one mentioned in the phrase. |
|||
$day = strtotime( "Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "first Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "second Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "third Thursday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n\n"; |
|||
|
|||
// Now the same where the current day-of-week does not match the one in the |
|||
// phrase. |
|||
$day = strtotime( "Friday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "first Friday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "second Friday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n"; |
|||
$day = strtotime( "third Friday Nov 2007" ); |
|||
echo date( DateTime::ISO8601, $day ), "\n\n"; |
|||
|
|||
?> |
|||
--EXPECT-- |
|||
2007-11-01T00:00:00+0100 |
|||
2007-11-01T00:00:00+0100 |
|||
2007-11-08T00:00:00+0100 |
|||
2007-11-15T00:00:00+0100 |
|||
|
|||
2007-11-01T00:00:00+0100 |
|||
2007-11-08T00:00:00+0100 |
|||
2007-11-15T00:00:00+0100 |
|||
2007-11-22T00:00:00+0100 |
|||
|
|||
2007-11-01T00:00:00+0100 |
|||
2007-11-08T00:00:00+0100 |
|||
2007-11-15T00:00:00+0100 |
|||
2007-11-22T00:00:00+0100 |
|||
|
|||
2007-11-02T00:00:00+0100 |
|||
2007-11-02T00:00:00+0100 |
|||
2007-11-09T00:00:00+0100 |
|||
2007-11-16T00:00:00+0100 |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue