From 3711d95e5e6f1df8c1950c033f4c3549a7c126fd Mon Sep 17 00:00:00 2001 From: Thomas Heck Date: Mon, 5 Aug 2013 16:35:24 +0200 Subject: [PATCH] DateTime::to_kivitendo_time: Formatierung eines DateTimes als Zeit --- SL/Helper/DateTime.pm | 5 +++++ SL/Locale.pm | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/SL/Helper/DateTime.pm b/SL/Helper/DateTime.pm index 639ed4531..3d6c78e10 100644 --- a/SL/Helper/DateTime.pm +++ b/SL/Helper/DateTime.pm @@ -12,6 +12,11 @@ sub today_local { return shift->now(time_zone => $::locale->get_local_time_zone)->truncate(to => 'day'); } +sub to_kivitendo_time { + my ($self, %params) = _hashify(1, @_); + return $::locale->format_date_object_to_time($self, %params); +} + sub to_kivitendo { my ($self, %params) = _hashify(1, @_); return $::locale->format_date_object($self, %params); diff --git a/SL/Locale.pm b/SL/Locale.pm index b6065da77..15b57df38 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -380,6 +380,12 @@ sub parse_date_to_object { return $yy && $mm && $dd ? DateTime->new(year => $yy, month => $mm, day => $dd) : undef; } +sub format_date_object_to_time { + my ($self, $datetime, %params) = @_; + + return $datetime->strftime('%H:%M'); +} + sub format_date_object { my ($self, $datetime, %params) = @_; -- 2.20.1