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