Sorry to bring up a really old thread, but this problem started to
annoy Win32 users of my software (DateTime::TimeZone->new('local')
dies with "Cannot determin local timezone even with TZ=JST-9 correctly
set)

On 8/7/06, Dave Rolsky <[EMAIL PROTECTED]> wrote:
> Hi, with these patches, DateTime::TimeZone->new('local')
> will work properly under the cirtcumstances with TZ=JST-9
> (common setting in Japan, means TZ=+0900).

If JST-9 is a common time zone, I'd think the simplest thing would be to
just add it to the list of links in DateTime::TimeZoneCatalog, and link it
to the Asia/Japan zone. Of course, then it'd have the same DST rules as
that zone, which may not be what you want.

We don' t have DST here and there's no problem. Actaully now I can see
JST-9 in LINKS of TimeZoneCatalog.pm. The only fix we need is to allow
"JST-9" in _could_be_valid_time_zone() as patched by Kenichi.

I guess the regexp can be tighten up like,

 return $_[0] =~ m,^[\w/]+(?:\+\-\d)?$, ? 1 : 0;

though.

==========
diff -ru DateTime-TimeZone-0.46/lib/DateTime/TimeZone/Local.pm
DateTime-TimeZone-0.46-patched/lib/DateTime/TimeZone/Local.pm
--- DateTime-TimeZone-0.46/lib/DateTime/TimeZone/Local.pm       2006-05-09
06:42:05.000000000 +0900
+++ DateTime-TimeZone-0.46-patched/lib/DateTime/TimeZone/Local.pm
2006-07-30
03:12:25.186375000 +0900
@@ -228,7 +228,10 @@
   return 0 unless defined $_[0];
   return 0 if $_[0] eq 'local';

-    return $_[0] =~ m,^[\w/]+$, ? 1 : 0;
+    return 1 if $_[0] =~ m,^[\w/]+$,;
+    return 1 if $_[0] =~ m,^\w+\s*[\+\-]\s*\d+$,;
+
+    return 0;
}



Thanks!

--
Tatsuhiko Miyagawa

Reply via email to