line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DateTime::Format::Flexible::lang::de; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
131
|
use strict; |
|
20
|
|
|
|
|
41
|
|
|
20
|
|
|
|
|
570
|
|
4
|
20
|
|
|
20
|
|
95
|
use warnings; |
|
20
|
|
|
|
|
36
|
|
|
20
|
|
|
|
|
16890
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new |
7
|
|
|
|
|
|
|
{ |
8
|
0
|
|
|
0
|
1
|
0
|
my ( $class , %params ) = @_; |
9
|
0
|
|
|
|
|
0
|
my $self = bless \%params , $class; |
10
|
0
|
|
|
|
|
0
|
return $self; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub months |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
return ( |
16
|
7344
|
|
|
7344
|
1
|
96967
|
qr{Jan(?:uar)?}i => 1, |
17
|
|
|
|
|
|
|
qr{Jän(?:er)?}i => 1, # Austrian?! |
18
|
|
|
|
|
|
|
qr{Feb(?:ruar)?}i => 2, |
19
|
|
|
|
|
|
|
qr{Mär(?:z)?|Maerz}i => 3, |
20
|
|
|
|
|
|
|
qr{Apr(?:il)?}i => 4, |
21
|
|
|
|
|
|
|
qr{Mai}i => 5, |
22
|
|
|
|
|
|
|
qr{Jun(?:i)?}i => 6, |
23
|
|
|
|
|
|
|
qr{Jul(?:i)?}i => 7, |
24
|
|
|
|
|
|
|
qr{Aug(?:ust)?}i => 8, |
25
|
|
|
|
|
|
|
qr{Sep(?:tember)?}i => 9, |
26
|
|
|
|
|
|
|
qr{Okt(?:ober)?}i => 10, |
27
|
|
|
|
|
|
|
qr{Nov(?:ember)?}i => 11, |
28
|
|
|
|
|
|
|
qr{Dez(?:ember)?}i => 12, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub days |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
return [ |
35
|
7344
|
|
|
7344
|
1
|
75682
|
{Montag => 1}, # Monday |
36
|
|
|
|
|
|
|
{Mo => 1}, # Monday |
37
|
|
|
|
|
|
|
{Dienstag => 2}, # Tuesday |
38
|
|
|
|
|
|
|
{Di => 2}, # Tuesday |
39
|
|
|
|
|
|
|
{Mittwoch => 3}, # Wednesday |
40
|
|
|
|
|
|
|
{Mi => 3}, # Wednesday |
41
|
|
|
|
|
|
|
{Donnerstag => 4}, # Thursday |
42
|
|
|
|
|
|
|
{Do => 4}, # Thursday |
43
|
|
|
|
|
|
|
{Freitag => 5}, # Friday |
44
|
|
|
|
|
|
|
{Fr => 5}, # Friday |
45
|
|
|
|
|
|
|
{Samstag => 6}, # Saturday |
46
|
|
|
|
|
|
|
{Sa => 6}, # Saturday |
47
|
|
|
|
|
|
|
{Sonnabend => 6}, # Saturday |
48
|
|
|
|
|
|
|
{Sonntag => 7}, # Sunday |
49
|
|
|
|
|
|
|
{So => 7}, # Sunday |
50
|
|
|
|
|
|
|
]; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub day_numbers |
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
return ( |
56
|
3672
|
|
|
3672
|
1
|
77983
|
q{erster} => 1, # first |
57
|
|
|
|
|
|
|
q{ersten} => 1, # first |
58
|
|
|
|
|
|
|
q{zweiter} => 2, # second |
59
|
|
|
|
|
|
|
q{dritter} => 3, # third |
60
|
|
|
|
|
|
|
q{vierter} => 4, # fourth |
61
|
|
|
|
|
|
|
q{fünfter} => 5, # fifth |
62
|
|
|
|
|
|
|
q{fuenfter} => 5, # fifth |
63
|
|
|
|
|
|
|
q{sechster} => 6, # sixth |
64
|
|
|
|
|
|
|
q{siebter} => 7, # seventh |
65
|
|
|
|
|
|
|
q{achter} => 8, # eighth |
66
|
|
|
|
|
|
|
q{neunter} => 9, # ninth |
67
|
|
|
|
|
|
|
q{zehnter} => 10, # tenth |
68
|
|
|
|
|
|
|
q{elfter} => 11, # eleventh |
69
|
|
|
|
|
|
|
q{zwölfter} => 12, # twelfth |
70
|
|
|
|
|
|
|
q{zwoelfter} => 12, # twelfth |
71
|
|
|
|
|
|
|
q{dreizehnter} => 13, # thirteenth |
72
|
|
|
|
|
|
|
q{vierzehnter} => 14, # fourteenth |
73
|
|
|
|
|
|
|
q{vierzehnten} => 14, # fourteenth |
74
|
|
|
|
|
|
|
q{fünfzehnter} => 15, # fifteenth |
75
|
|
|
|
|
|
|
q{fuenfzehnter} => 15, # fifteenth |
76
|
|
|
|
|
|
|
q{sechzehnter} => 16, # sixteenth |
77
|
|
|
|
|
|
|
q{siebzehnter} => 17, # seventeenth |
78
|
|
|
|
|
|
|
q{achtzehnter} => 18, # eithteenth |
79
|
|
|
|
|
|
|
q{neunzehnter} => 19, # ninteenth |
80
|
|
|
|
|
|
|
q{zwanzigster} => 20, # twentieth |
81
|
|
|
|
|
|
|
q{einundzwanzigster} => 21, # twenty first |
82
|
|
|
|
|
|
|
q{zweiundzwanzigster} => 22, # twenty second |
83
|
|
|
|
|
|
|
q{dreiundzwanzigster} => 23, # twenty third |
84
|
|
|
|
|
|
|
q{vierundzwanzigster} => 24, # twenty fourth |
85
|
|
|
|
|
|
|
q{fünfundzwanzigster} => 25, # twenty fifth |
86
|
|
|
|
|
|
|
q{fuenfundzwanzigster} => 25, # twenty fifth |
87
|
|
|
|
|
|
|
q{sechsundzwanzigster} => 26, # twenty sixth |
88
|
|
|
|
|
|
|
q{siebenundzwanzigster} => 27, # twenty seventh |
89
|
|
|
|
|
|
|
q{achtundzwanzigster} => 28, # twenty eighth |
90
|
|
|
|
|
|
|
q{neunundzwanzigster} => 29, # twenty ninth |
91
|
|
|
|
|
|
|
q{dreißigster} => 30, # thirtieth |
92
|
|
|
|
|
|
|
q{dreissigster} => 30, # thirtieth |
93
|
|
|
|
|
|
|
q{einunddreißigster} => 31, # thirty first |
94
|
|
|
|
|
|
|
q{einunddreissigster} => 31, # thirty first |
95
|
|
|
|
|
|
|
); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub hours |
99
|
|
|
|
|
|
|
{ |
100
|
|
|
|
|
|
|
return ( |
101
|
3672
|
|
|
3672
|
1
|
16394
|
Mittag => '12:00:00', # noon |
102
|
|
|
|
|
|
|
mittags => '12:00:00', # noon |
103
|
|
|
|
|
|
|
Mitternacht => '00:00:00', # midnight |
104
|
|
|
|
|
|
|
mitternachts => '00:00:00', # midnight |
105
|
|
|
|
|
|
|
); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub remove_strings |
109
|
|
|
|
|
|
|
{ |
110
|
|
|
|
|
|
|
return ( |
111
|
|
|
|
|
|
|
# we want to remove ' am ' only when it does not follow a digit |
112
|
|
|
|
|
|
|
# we also don't want to remove am when it follows a capital T, |
113
|
|
|
|
|
|
|
# we can have a capital T when we have already determined the time |
114
|
|
|
|
|
|
|
# part of a string |
115
|
|
|
|
|
|
|
# if we just remove ' am ', it removes am/pm designation, losing accuracy |
116
|
3672
|
|
|
3672
|
1
|
16745
|
qr{(?<!\d|T)\sam\b}i, # remove ' am ' as in '20. Feb am Mittag' |
117
|
|
|
|
|
|
|
# we can also remove it if it is at the beginning |
118
|
|
|
|
|
|
|
qr{\A\bam\b}i, |
119
|
|
|
|
|
|
|
qr{\bum\b}i, # remove ' um ' as in '20. Feb um Mitternacht' |
120
|
|
|
|
|
|
|
); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub parse_time |
124
|
|
|
|
|
|
|
{ |
125
|
3672
|
|
|
3672
|
1
|
6449
|
my ( $self, $date ) = @_; |
126
|
3672
|
|
|
|
|
6603
|
return $date; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub string_dates |
130
|
|
|
|
|
|
|
{ |
131
|
3672
|
|
|
3672
|
1
|
9254
|
my $base_dt = DateTime::Format::Flexible->base; |
132
|
|
|
|
|
|
|
return ( |
133
|
0
|
|
|
0
|
|
0
|
jetzt => sub { return $base_dt->datetime }, # now |
134
|
0
|
|
|
0
|
|
0
|
heute => sub { return $base_dt->clone->truncate( to => 'day' )->ymd } , # today |
135
|
0
|
|
|
0
|
|
0
|
morgen => sub { return $base_dt->clone->truncate( to => 'day' )->add( days => 1 )->ymd }, # tomorrow |
136
|
0
|
|
|
0
|
|
0
|
gestern => sub { return $base_dt->clone->truncate( to => 'day' )->subtract( days => 1 )->ymd }, # yesterday |
137
|
0
|
|
|
0
|
|
0
|
'übermorgen' => sub { return DateTime->today->add( days => 2 )->ymd }, # overmorrow (the day after tomorrow) don't know if the Umlaut works |
138
|
0
|
|
|
0
|
|
0
|
uebermorgen => sub { return DateTime->today->add( days => 2 )->ymd }, # overmorrow (the day after tomorrow) |
139
|
0
|
|
|
0
|
|
0
|
Epoche => sub { return DateTime->from_epoch( epoch => 0 ) }, |
140
|
0
|
|
|
0
|
|
0
|
'-unendlich' => sub { return '-infinity' }, |
141
|
2
|
|
|
2
|
|
4
|
unendlich => sub { return 'infinity' }, |
142
|
3672
|
|
|
|
|
873175
|
); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub relative |
146
|
|
|
|
|
|
|
{ |
147
|
|
|
|
|
|
|
return ( |
148
|
|
|
|
|
|
|
# as in 3 years ago, -3 years |
149
|
3672
|
|
|
3672
|
1
|
27594
|
ago => qr{\bvor\b|\A\-}i, |
150
|
|
|
|
|
|
|
# as in 3 years from now, +3 years |
151
|
|
|
|
|
|
|
from => qr{\bab\b\s\bjetzt\b|\A\+}i, |
152
|
|
|
|
|
|
|
# as in next Monday |
153
|
|
|
|
|
|
|
next => qr{\bnächste|nachste\b}i, |
154
|
|
|
|
|
|
|
# as in last Monday |
155
|
|
|
|
|
|
|
last => qr{\bletzten\b}i, |
156
|
|
|
|
|
|
|
); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub math_strings |
160
|
|
|
|
|
|
|
{ |
161
|
|
|
|
|
|
|
return ( |
162
|
4
|
|
|
4
|
1
|
60
|
Jahr => 'years' , |
163
|
|
|
|
|
|
|
Jahre => 'years' , |
164
|
|
|
|
|
|
|
Jahren => 'years' , |
165
|
|
|
|
|
|
|
Monat => 'months' , |
166
|
|
|
|
|
|
|
Monate => 'months' , |
167
|
|
|
|
|
|
|
Tag => 'days' , |
168
|
|
|
|
|
|
|
Tage => 'days' , |
169
|
|
|
|
|
|
|
Stunde => 'hours' , |
170
|
|
|
|
|
|
|
Stunden => 'hours' , |
171
|
|
|
|
|
|
|
Minute => 'minutes' , |
172
|
|
|
|
|
|
|
Minuten => 'minutes' , |
173
|
|
|
|
|
|
|
Woche => 'weeks', |
174
|
|
|
|
|
|
|
Wochen => 'weeks', |
175
|
|
|
|
|
|
|
); |
176
|
|
|
|
|
|
|
} |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub timezone_map |
179
|
|
|
|
|
|
|
{ |
180
|
|
|
|
|
|
|
# http://home.tiscali.nl/~t876506/TZworld.html |
181
|
|
|
|
|
|
|
return ( |
182
|
3672
|
|
|
3672
|
1
|
15602
|
CET => 'Europe/Berlin', |
183
|
|
|
|
|
|
|
CEST => 'Europe/Berlin', |
184
|
|
|
|
|
|
|
MEZ => 'Europe/Berlin', # German Version: Mitteleuropäische Zeit |
185
|
|
|
|
|
|
|
MESZ => 'Europe/Berlin', # Mitteleuropäische Sommerzeit |
186
|
|
|
|
|
|
|
); |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
1; |
190
|
|
|
|
|
|
|
__END__ |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=encoding utf-8 |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 NAME |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
DateTime::Format::Flexible::lang::de - german language plugin |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 DESCRIPTION |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
You should not need to use this module directly. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
If you only want to use one language, specify the lang property when parsing a date. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
example: |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
my $dt = DateTime::Format::Flexible->parse_datetime( |
207
|
|
|
|
|
|
|
'Montag, 6. Dez 2010' , |
208
|
|
|
|
|
|
|
lang => ['de'] |
209
|
|
|
|
|
|
|
); |
210
|
|
|
|
|
|
|
# $dt is now 2010-12-06T00:00:00 |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
Note that this is not required, by default ALL languages are scanned when trying to parse a date. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 new |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
Instantiate a new instance of this module. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head2 months |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
month name regular expressions along with the month numbers (Jan(:?uar)? => 1) |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 days |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
day name regular expressions along the the day numbers (Montag => 1) |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head2 day_numbers |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
maps day of month names to the corresponding numbers (erster => 01) |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head2 hours |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
maps hour names to numbers (Mittag => 12:00:00) |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head2 remove_strings |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
strings to remove from the date (um as in um Mitternacht) |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=head2 parse_time |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
currently does nothing |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head2 string_dates |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
maps string names to real dates (jetzt => DateTime->now) |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=head2 relative |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
parse relative dates (ago => vor, from => a jetzt, next => nachste, last => letzten) |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=head2 math_strings |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
useful strings when doing datetime math |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head2 timezone_map |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
maps unofficial timezones to official timezones for this language (MEZ => Europe/Berlin) |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head1 AUTHOR |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
Mark Trettin <nulldevice.mark@gmx.de> |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
Based on DateTime::Format::Flexible::lang::en by |
263
|
|
|
|
|
|
|
Tom Heady |
264
|
|
|
|
|
|
|
CPAN ID: thinc |
265
|
|
|
|
|
|
|
Punch, Inc. |
266
|
|
|
|
|
|
|
cpan@punch.net |
267
|
|
|
|
|
|
|
http://www.punch.net/ |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Copyright 2011 Mark Trettin. |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
274
|
|
|
|
|
|
|
modify it under the terms of either: |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=over 4 |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=item * the GNU General Public License as published by the Free |
279
|
|
|
|
|
|
|
Software Foundation; either version 1, or (at your option) any |
280
|
|
|
|
|
|
|
later version, or |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=item * the Artistic License version. |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
=back |
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
=head1 SEE ALSO |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
F<DateTime::Format::Flexible> |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=cut |
291
|
|
|
|
|
|
|
### Local variables: |
292
|
|
|
|
|
|
|
### coding: utf-8 |
293
|
|
|
|
|
|
|
### End: |