This actually mostly just worked already if the tz offset was at the end of the string since the minutes just got ignored. But I did change the behavior so that the "hh:mm", "hhmm" and "hh" are all supported (even if not at end of string).
Although your example code is really a different problem: how to handle a tz offset that is a fractional hour. Without further context we don't really know what timezone to use and we can't just fallback to one of the generic GMT+/- timezones because the tzinfo database doesn't define any fractional hour timezones like GMT-3:30. I just left the current behavior to pick one of the standard generic timezones - so if your offset is is -3:30, then you will get GMT+3 as the actual TimeZone instance. That seems a lesser evil than using timezone names which aren't standardized by tzinfo database. Just another reason that politicians that define fractional UTC offsets are just plain evil.
tcolar Fri 10 Jun 2011
ToLocale says that "z" should support ISO8601 Timezones http://fantom.org/doc/sys/DateTime.html#toLocale
However 8601 says timezone can be written'+05:00' (that works) but also
+05
or+0500
(neither works)brian Fri 10 Jun 2011
Promoted to ticket #1556 and assigned to brian
I haven't personally ever seen that format used. But easy to add, I will take a look.
tcolar Fri 10 Jun 2011
Used in Mail messages:
RFC 5322 3.3
brian Mon 14 Nov 2011
Ticket resolved in 1.0.61
This actually mostly just worked already if the tz offset was at the end of the string since the minutes just got ignored. But I did change the behavior so that the "hh:mm", "hhmm" and "hh" are all supported (even if not at end of string).
Although your example code is really a different problem: how to handle a tz offset that is a fractional hour. Without further context we don't really know what timezone to use and we can't just fallback to one of the generic GMT+/- timezones because the tzinfo database doesn't define any fractional hour timezones like GMT-3:30. I just left the current behavior to pick one of the standard generic timezones - so if your offset is is -3:30, then you will get GMT+3 as the actual TimeZone instance. That seems a lesser evil than using timezone names which aren't standardized by tzinfo database. Just another reason that politicians that define fractional UTC offsets are just plain evil.