package DateTime::Format::Atom;

use strict;
use warnings;

use version; our $VERSION = qv('v1.2.0');

use DateTime::Format::RFC3339 qw( );

use constant FIRST_IDX  => 0;
use constant IDX_HELPER => FIRST_IDX + 0;
use constant NEXT_IDX   => FIRST_IDX + 1;

sub new {
   my ($class, %opts) = @_;
   my $helper = DateTime::Format::RFC3339->new( uc_only => 1 );
   return bless([
      $helper,  # IDX_HELPER
   ], $class);

sub parse_datetime {
   my ($self, $str) = @_;

   $self = $self->new()
      if !ref($self);

   return $self->[IDX_HELPER]->parse_datetime($str);

sub format_datetime {
   my ($self, $dt) = @_;

#   $self = $self->new()
#      if !ref($self);
#   return $self->[IDX_HELPER]->format_datetime($dt);
   return DateTime::Format::RFC3339->format_datetime($dt);



=head1 NAME

DateTime::Format::Atom - Parse and format Atom datetime strings

=head1 VERSION

Version 1.2.0


    use DateTime::Format::Atom;

    my $f = DateTime::Format::Atom->new();
    my $dt = $f->parse_datetime( '2002-07-01T13:50:05Z' );

    # 2002-07-01T13:50:05Z
    print $f->format_datetime($dt);


This module understands the Atom date/time format, an ISO 8601 profile, defined
at L<>

It can be used to parse these formats in order to create the appropriate

All the work is actually done by L<DateTime::Format::RFC3339>.

=head1 METHODS


=item C<parse_datetime($string)>

Given a Atom datetime string, this method will return a new
L<DateTime> object.

If given an improperly formatted string, this method will croak.

For a more flexible parser, see L<DateTime::Format::ISO8601>.

=item C<format_datetime($datetime)>

Given a L<DateTime> object, this methods returns a Atom datetime

For simplicity, the datetime will be converted to UTC first.


=head1 SEE ALSO

=over 4

=item * L<DateTime>

=item * L<DateTime::Format::RFC3339>

=item * L<DateTime::Format::ISO8601>

=item * L<>, "Date and Time on the Internet: Timestamps"

=item * L<>, "The Atom Syndication Format"


=head1 BUGS

Please report any bugs or feature requests to C<bug-Datetime-Format-Atom at>,
or through the web interface at L<>.
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc DateTime::Format::Atom

You can also look for information at:

=over 4

=item * Search CPAN


=item * RT: CPAN's request tracker


=item * AnnoCPAN: Annotated CPAN documentation


=item * CPAN Ratings



=head1 AUTHOR

Eric Brine, C<< <> >>


No rights reserved.

The author has dedicated the work to the Commons by waiving all of his
or her rights to the work worldwide under copyright law and all related or
neighboring legal rights he or she had in the work, to the extent allowable by

Works under CC0 do not require attribution. When citing the work, you should
not imply endorsement by the author.