Bug in old-locale?

Ashley Yakeley ashley at semantic.org
Tue Apr 21 11:31:42 EDT 2009


Magnus Therning wrote:
> On Mon, Apr 20, 2009 at 11:27 PM, Deniz Dogan <deniz.a.m.dogan at gmail.com> wrote:
>> Hi
>>
>> Is there a bug in the old-locale package? I tried the following simple program:
>>
>> import Data.Time
>> import System.Locale
>>
>> main = do
>>  time <- getCurrentTime
>>  putStrLn $ formatTime defaultTimeLocale rfc822DateFormat time
>>
>> The above program prints:
>>
>> Mon, d Apr 2009 15:23:56 UTC
>>
>> Notice "Mon, d", where "d" should be the day of the month. Looking at
>> the source code in the package, I see:
>>
>> rfc822DateFormat = "%a, %_d %b %Y %H:%M:%S %Z"
>>
>> So what's up with %_d?
> 
> That looks like an error to me.  According to the date(1) manpage, an
> underbar pads with spaces.
> 
> % date +"%a, %_d %b %Y %H:%M:%S %Z"
> Tue, 21 Apr 2009 00:25:50 SGT

It looks like old-locale and time have different ideas of date formats. 
Possibly this should be fixed in the time package.

By the way, if old-locale is "old", what should be used instead?

-- 
Ashley Yakeley


More information about the Libraries mailing list