Storing Olson abbreviation in DateTime::TimeZone::OffsetOnly

[email protected] (Evan Carroll)
Newsgroups perl.datetime
Message-ID <[email protected]>
I'm still trying to finish up DateTimeX::TimeZone, so I've got a
question.. I'm looking to store the Olson abbreviation name in
DateTime::TimeZone::OffsetOnly because it is not easily 1:1.

So I'm looking for a syntax like:
  my $offset_tz = DateTime::TimeZone->new( name => 'CST', offset => '-0300' );

But because name is already associated with offset, I'm proposing this
become an accepted syntax
  my $offset_tz = DateTime::TimeZone->new( name => '-0300',
abbreviation => 'CST' );
  $offset_tz->abbreviation;

DateTime::TimeZone is a factory for DateTime::TimeZone::OffsetOnly in
the above. OffsetOnly objects should provide for the storage of the
abbreviation and make it accessible with method call. I need this
functionality to implement %Z in Strptime. Using
MooseX::Types::DateTime::ButMaintained a value of CEST would coerce to
the right OffsetOnly, but it would lose the abbreviation it was
rendered with because Moose types don't support retrieving the
pre-coerced value. Would a patch that stores the abbreviation in
OffsetOnly and patches the DateTime constructor to accommodate it be
acceptable?


-- 
Evan Carroll
System Lord of the Internets
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.