package Common::Date::ISO;

use Common::Date::Pattern;

use base 'Common::Date';

sub priority { 1000 }
sub type     { 'iso' }

sub _patterns {
    [
        # matches the standard ISO date YYYY-MM-DD
        new Common::Date::Pattern( pattern => '(\d{4})[\-\/](\d{1,2})[\-\/](\d{1,2})', month => 2, day => 3, year => 1 ),

        # matches the standard mysql date/time stamp YYYY-MM-DD HH:MM:SS
        new Common::Date::Pattern( pattern => '(\d{4})[\-\/](\d{1,2})[\-\/](\d{1,2}) \d{2}:\d{2}:\d{2}', month => 2, day => 3, year => 1 ),

        # matches the ISO combined date/time stamp YYYY-MM-DDTHH:MM:SS-ZZ:ZZ
        # where the ZZ:ZZ is the offset from GMT
        new Common::Date::Pattern(
            pattern => '(\d{4})[\-\/](\d{1,2})[\-\/](\d{1,2})T\d{2}:\d{2}:\d{2}[\+\-]\d{2}:\d{2}',
            month   => 2,
            day     => 3,
            year    => 1
        ),
    ];
}

1;
