Revision 14817fd9
Von Moritz Bunkus vor fast 12 Jahren hinzugefügt
SL/Helper/DateTime.pm | ||
---|---|---|
10 | 10 |
return shift->now(time_zone => $::locale->get_local_time_zone)->truncate(to => 'day'); |
11 | 11 |
} |
12 | 12 |
|
13 |
sub to_lxoffice {
|
|
13 |
sub to_kivitendo {
|
|
14 | 14 |
my $self = shift; |
15 | 15 |
my %params = (scalar(@_) == 1) && (ref($_[0]) eq 'HASH') ? %{ $_[0] } : @_; |
16 | 16 |
return $::locale->format_date_object($self, %params); |
17 | 17 |
} |
18 | 18 |
|
19 |
sub from_lxoffice { |
|
19 |
sub to_lxoffice { |
|
20 |
# Legacy name. |
|
21 |
goto &to_kivitendo; |
|
22 |
} |
|
23 |
|
|
24 |
sub from_kivitendo { |
|
20 | 25 |
return $::locale->parse_date_to_object(\%::myconfig, $_[1]); |
21 | 26 |
} |
22 | 27 |
|
28 |
sub from_lxoffice { |
|
29 |
# Legacy name. |
|
30 |
gofrom &from_kivitendo; |
|
31 |
} |
|
32 |
|
|
23 | 33 |
1; |
24 | 34 |
|
25 | 35 |
__END__ |
... | ... | |
42 | 52 |
|
43 | 53 |
Returns the current date with the time zone set to the local time zone. |
44 | 54 |
|
45 |
=item C<to_lxoffice %param>
|
|
55 |
=item C<to_kivitendo %param>
|
|
46 | 56 |
|
47 | 57 |
Formats the date and time according to the current kivitendo user's |
48 | 58 |
date format with L<Locale::format_datetime_object>. |
49 | 59 |
|
50 |
=item C<from_lxoffice $string> |
|
60 |
The legacy name C<to_lxoffice> is still supported. |
|
61 |
|
|
62 |
=item C<from_kivitendo $string> |
|
51 | 63 |
|
52 | 64 |
Parses a date string formatted in the current kivitendo user's date |
53 | 65 |
format and returns an instance of L<DateTime>. |
54 | 66 |
|
55 | 67 |
Note that only dates can be parsed at the moment, not the time |
56 |
component (as opposed to L<to_lxoffice>). |
|
68 |
component (as opposed to L<to_kivitendo>). |
|
69 |
|
|
70 |
The legacy name C<from_lxoffice> is still supported. |
|
57 | 71 |
|
58 | 72 |
=back |
59 | 73 |
|
Auch abrufbar als: Unified diff
DateTime-Helfer: Funktionsnamen in (to|from)_kivitendo umbenannt
Mit Legacy-Aliasen.