forked from Wavyzz/dolibarr
Fix month on 2 chars. Some setup return on 1 char only. More phpunit
assert.
This commit is contained in:
@@ -1375,7 +1375,8 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
if (preg_match('/__b__/i',$format))
|
||||
{
|
||||
// Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs.
|
||||
$month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Remove this
|
||||
$month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
||||
$month=sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
||||
if ($encodetooutput)
|
||||
{
|
||||
$monthtext=$outputlangs->transnoentities('Month'.$month);
|
||||
|
||||
@@ -335,6 +335,11 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('02/01/1970 00:00',$result);
|
||||
|
||||
// Check %a and %b format for fr_FR
|
||||
$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('Jeu Jan. Janvier',$result);
|
||||
|
||||
// Check day format for en_US
|
||||
$outputlangs=new Translate('',$conf);
|
||||
$outputlangs->setDefaultLang('en_US');
|
||||
@@ -345,9 +350,9 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('01/02/1970',$result);
|
||||
|
||||
// Check %a and %b format for en_US
|
||||
$result=dol_print_date(0,'%a %b',true,$outputlangs);
|
||||
$result=dol_print_date(0,'%a %b %B',true,$outputlangs);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('Thu Jan',$result);
|
||||
$this->assertEquals('Thu Jan January',$result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user