Re: NSDateFormatter bug in timeZone
Re: NSDateFormatter bug in timeZone
- Subject: Re: NSDateFormatter bug in timeZone
- From: Alastair Houghton <email@hidden>
- Date: Mon, 27 Apr 2009 15:35:24 +0100
On 27 Apr 2009, at 15:13, jon wrote:
oh wait, you are saying the Australia has an EST... I see.
in that case, do you think Apple should have this work, which i
tried, of having this line before making the final format call of
just using PDT.
[inputFormatter setLocale:[[NSLocale alloc]
initWithLocaleIdentifier:@"en_US"]];
Honestly, I'm not sure whether it should or not; I haven't thought
about it *nearly* enough.
My guess (and it is just a guess) is that Apple's date formatter (in
non-natural language mode) mirrors the behaviour of the POSIX
strptime() function, which is explicitly documented as only allowing
the zone abbreviations of the local time zone or the value "GMT",
precisely because of the ambiguity. Interestingly I can't even see
"%Z" in the allowed list of format specifiers for strptime() in SUSv3/
POSIX.1, so it would seem to be an extension (albeit an obvious one).
I think it should probably take a stab at it when in natural language
mode, but otherwise I'm not sure it's a good idea to do anything other
than maybe try to parse a full POSIX time zone specification (ala the
TZ environment variable).
Put another way, I suspect a common error in Australia is to have your
machine configured in the U.S. locale. It's certainly a common error
here in the U.K. (which is why we get documents sent to us in U.S.
Letter paper size, for instance). So there is a question over whether
it is wise to behave in a highly unexpected manner in that case.
However, all of this is in an off-the-cuff e-mail :-) So I could
easily be persuaded to change my mind.
If you don't think the current behaviour is right, file a bug report
and explain what you expected and what actually happened. I'm sure
someone at Apple will take a look and come to a decision one way or
another.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden