PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Date and Time » Date » Bug #3022

Abbreviations of Weekday (and Month)

Details

Submitted2004-12-23 15:15 UTC
Frombruno dot baketaric at email dot de
Assignedpajoye
StatusClosed
PackageDate
PHP Version4.3.9
OSindependent
Roadmaps(Not assigned)

Comments

[2004-12-23 15:15 UTC] bruno dot baketaric at email dot de

Description:
------------
The abbreviation length cannot be set using Date::format(), it always defaults to 3 in Date_Calc::getWeekdayAbbrname(). This is wrong for i.e. German abbreviations of weekdays (Mo,Di,Mi...). One solution could be to set the length parameter according to the current locale. Another would be (and I did it this way), to add a method getWeekDaysAbbr() that uses strftime('%a',...) to Date_Calc and make getWeekdayAbbrname() use it.
I don't believe there are any side effects. Maybe the same applies to Month names (I don't know the abbreviations in all locales as good as strftime does ;-) ).

Reproduce code:
---------------
setlocale(LC_TIME,"de_DE");
$t = new Date();
echo($t->format('%a'));

Expected result:
----------------
Di

Actual result:
--------------
Die