projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8484285
)
Funktion zum Parsen eines Datums in ein DateTime-Objekt
author
Moritz Bunkus
<m.bunkus@linet-services.de>
Thu, 18 Feb 2010 15:03:35 +0000
(16:03 +0100)
committer
Sven Schöling
<s.schoeling@linet-services.de>
Tue, 20 Jul 2010 11:26:53 +0000
(13:26 +0200)
Das parsende Datum muss dabei im vom Benutzer eingestellten
Datumsformat vorliegen.
SL/Locale.pm
patch
|
blob
|
history
diff --git
a/SL/Locale.pm
b/SL/Locale.pm
index
47268ec
..
5c80083
100644
(file)
--- a/
SL/Locale.pm
+++ b/
SL/Locale.pm
@@
-36,6
+36,7
@@
package Locale;
+use DateTime;
use Encode;
use List::Util qw(first);
use List::MoreUtils qw(any);
@@
-373,6
+374,13
@@
sub parse_date {
return ($yy, $mm, $dd);
}
+sub parse_date_to_object {
+ my $self = shift;
+ my ($yy, $mm, $dd) = $self->parse_date(@_);
+
+ return $yy && $mm && $dd ? DateTime->new(year => $yy, month => $mm, day => $dd) : undef;
+}
+
sub reformat_date {
$main::lxdebug->enter_sub();