derick Tue Aug 5 18:02:39 2008 UTC
Added files:
/php-src/ext/date/tests date_period.phpt
Modified files:
/php-src/ext/date/lib tm2unixtime.c
Log:
- Fixed a bug that caused miscalculations with the "last <weekday> of <n>
month" relative time string.
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/tm2unixtime.c?r1=1.28&r2=1.29&diff_format=u
Index: php-src/ext/date/lib/tm2unixtime.c
diff -u php-src/ext/date/lib/tm2unixtime.c:1.28
php-src/ext/date/lib/tm2unixtime.c:1.29
--- php-src/ext/date/lib/tm2unixtime.c:1.28 Tue Jul 8 17:56:36 2008
+++ php-src/ext/date/lib/tm2unixtime.c Tue Aug 5 18:02:39 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tm2unixtime.c,v 1.28 2008/07/08 17:56:36 derick Exp $ */
+/* $Id: tm2unixtime.c,v 1.29 2008/08/05 18:02:39 derick Exp $ */
#include "timelib.h"
@@ -277,6 +277,7 @@
break;
}
}
+ do_normalize(time);
}
static timelib_sll do_years(timelib_sll year)
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/date_period.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/date_period.phpt
+++ php-src/ext/date/tests/date_period.phpt
--TEST--
DatePeriod
--INI--
date.timezone=UTC
--FILE--
<?php
$db = new DateTime( '2008-01-01' );
$de = new DateTime( '2008-12-31' );
$di = DateInterval::createFromDateString( 'first day of next month' );
foreach ( new DatePeriod( $db, $di, $de ) as $dt )
{
echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" );
}
?>
<?php
$db = new DateTime( '2007-12-31' );
$de = new DateTime( '2009-12-31 23:59:59' );
$di = DateInterval::createFromDateString( 'last thursday of next month' );
foreach ( new DatePeriod( $db, $di, $de, DatePeriod::EXCLUDE_START_DATE ) as
$dt )
{
echo $dt->format( "l Y-m-d H:i:s\n" );
}
?>
--EXPECT--
Tuesday 2008-01-15
Tuesday 2008-02-19
Tuesday 2008-03-18
Tuesday 2008-04-15
Tuesday 2008-05-20
Tuesday 2008-06-17
Tuesday 2008-07-15
Tuesday 2008-08-19
Tuesday 2008-09-16
Tuesday 2008-10-21
Tuesday 2008-11-18
Tuesday 2008-12-16
Thursday 2008-01-31 00:00:00
Thursday 2008-02-28 00:00:00
Thursday 2008-03-27 00:00:00
Thursday 2008-04-24 00:00:00
Thursday 2008-05-29 00:00:00
Thursday 2008-06-26 00:00:00
Thursday 2008-07-31 00:00:00
Thursday 2008-08-28 00:00:00
Thursday 2008-09-25 00:00:00
Thursday 2008-10-30 00:00:00
Thursday 2008-11-27 00:00:00
Thursday 2008-12-25 00:00:00
Thursday 2009-01-29 00:00:00
Thursday 2009-02-26 00:00:00
Thursday 2009-03-26 00:00:00
Thursday 2009-04-30 00:00:00
Thursday 2009-05-28 00:00:00
Thursday 2009-06-25 00:00:00
Thursday 2009-07-30 00:00:00
Thursday 2009-08-27 00:00:00
Thursday 2009-09-24 00:00:00
Thursday 2009-10-29 00:00:00
Thursday 2009-11-26 00:00:00
Thursday 2009-12-31 00:00:00
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php