mirror of
https://github.com/friendica/friendica
synced 2025-05-01 08:24:23 +02:00
Only call DateTimeFormat::fix() when there's an Exception
- This prevents valid date/time strings to be mangled by fix()
This commit is contained in:
parent
b5ad8c3e15
commit
bee6506d33
2 changed files with 29 additions and 17 deletions
|
@ -141,4 +141,18 @@ class DateTimeFormatTest extends MockedTest
|
|||
{
|
||||
$this->assertEquals($expected, DateTimeFormat::fix($dateString));
|
||||
}
|
||||
|
||||
/**
|
||||
* This test is meant to ensure DateTimeFormat::fix() isn't called on relative date/time strings
|
||||
*
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function testConvertRelative()
|
||||
{
|
||||
$now = DateTimeFormat::utcNow('U');
|
||||
$date = DateTimeFormat::utc('now - 3 days', 'U');
|
||||
|
||||
$this->assertEquals(259200, $now - $date);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue