DateTime-Format-Flexible
view release on metacpan or search on metacpan
lib/DateTime/Format/Flexible/lang/de.pm view on Meta::CPAN
sub parse_time
{
my ( $self, $date ) = @_;
return $date;
}
sub string_dates
{
my $base_dt = DateTime::Format::Flexible->base;
return (
jetzt => sub { return $base_dt->datetime }, # now
heute => sub { return $base_dt->clone->truncate( to => 'day' )->ymd } , # today
morgen => sub { return $base_dt->clone->truncate( to => 'day' )->add( days => 1 )->ymd }, # tomorrow
gestern => sub { return $base_dt->clone->truncate( to => 'day' )->subtract( days => 1 )->ymd }, # yesterday
'übermorgen' => sub { return DateTime->today->add( days => 2 )->ymd }, # overmorrow (the day after tomorrow) don't know if the Umlaut works
uebermorgen => sub { return DateTime->today->add( days => 2 )->ymd }, # overmorrow (the day after tomorrow)
Epoche => sub { return DateTime->from_epoch( epoch => 0 ) },
'-unendlich' => sub { return '-infinity' },
unendlich => sub { return 'infinity' },
);
}
sub relative
{
return (
# as in 3 years ago, -3 years
ago => qr{\bvor\b|\A\-}i,
# as in 3 years from now, +3 years
from => qr{\bab\b\s\bjetzt\b|\A\+}i,
# as in next Monday
next => qr{\bnächste|nachste\b}i,
# as in last Monday
last => qr{\bletzten\b}i,
);
}
sub math_strings
{
return (
Jahr => 'years' ,
Jahre => 'years' ,
Jahren => 'years' ,
Monat => 'months' ,
Monate => 'months' ,
Tag => 'days' ,
Tage => 'days' ,
Stunde => 'hours' ,
Stunden => 'hours' ,
Minute => 'minutes' ,
Minuten => 'minutes' ,
Woche => 'weeks',
Wochen => 'weeks',
);
}
sub timezone_map
{
# http://home.tiscali.nl/~t876506/TZworld.html
return (
CET => 'Europe/Berlin',
CEST => 'Europe/Berlin',
MEZ => 'Europe/Berlin', # German Version: Mitteleuropäische Zeit
MESZ => 'Europe/Berlin', # Mitteleuropäische Sommerzeit
);
}
1;
__END__
=encoding utf-8
=head1 NAME
DateTime::Format::Flexible::lang::de - german language plugin
=head1 DESCRIPTION
You should not need to use this module directly.
If you only want to use one language, specify the lang property when parsing a date.
example:
my $dt = DateTime::Format::Flexible->parse_datetime(
'Montag, 6. Dez 2010' ,
lang => ['de']
);
# $dt is now 2010-12-06T00:00:00
Note that this is not required, by default ALL languages are scanned when trying to parse a date.
=head2 new
Instantiate a new instance of this module.
=head2 months
month name regular expressions along with the month numbers (Jan(:?uar)? => 1)
=head2 days
day name regular expressions along the the day numbers (Montag => 1)
=head2 day_numbers
maps day of month names to the corresponding numbers (erster => 01)
=head2 hours
maps hour names to numbers (Mittag => 12:00:00)
=head2 remove_strings
strings to remove from the date (um as in um Mitternacht)
=head2 parse_time
currently does nothing
=head2 string_dates
( run in 0.625 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )