| 1 | package DTL::Fast::Filter::Date; | ||||||||||
| 2 | 3 | ▶ | use strict; use utf8; use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | ▶ | use parent 'DTL::Fast::Filter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 3 | $DTL::Fast::FILTER_HANDLERS{'date'} = __PACKAGE__; | |||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use DTL::Fast::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | #@Override | ||||||||||
| 10 | #@todo make pre-defined formats from Django | ||||||||||
| 11 | sub parse_parameters | ||||||||||
| 12 | { | ||||||||||
| 13 | 3 | ▶ | my $self = shift; | ||||||||
|
Subroutine
parse_parameters: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||
| 14 | 0 | push @{$self->{'parameter'}}, DTL::Fast::Variable->new('"DATE_FORMAT"') | |||||||||
| 15 | 3 | ▶ | if not scalar @{$self->{'parameter'}}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 3 | $self->{'format'} = $self->{'parameter'}->[0]; | |||||||||
| 17 | 3 | return $self; | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | #@Override | ||||||||||
| 21 | sub filter | ||||||||||
| 22 | { | ||||||||||
| 23 | 0 | ▶ | my $self = shift; # self | ||||||||
|
Subroutine
filter: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 24 | 0 | shift; # filter_manager | |||||||||
| 25 | 0 | my $value = shift; | |||||||||
| 26 | 0 | my $context = shift; | |||||||||
| 27 | |||||||||||
| 28 | 0 | my $format = $self->{'format'}->render($context); | |||||||||
| 29 | |||||||||||
| 30 | 0 | return DTL::Fast::Utils::time2str_php($format, $value); | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 3 | 1; | |||||||||