my $value = shift;
my %args = ( Arguments => [],
Escape => 1,
- FormatDate => \&default_FormatDate,
@_ );
+ my $FormatDate = $m->notes('FormatDate') || \&default_FormatDate;
+
if ( ref $value ) {
if ( ref $value eq 'RT::Date' ) {
- return $args{FormatDate}->($value);
+ return $FormatDate->($value);
} elsif ( UNIVERSAL::isa( $value, 'CODE' ) ) {
my @tmp = $value->( @{ $args{'Arguments'} } );
return ProcessColumnMapValue( ( @tmp > 1 ? \@tmp : $tmp[0] ), %args );
my $content = $Object->Content;
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
$DateObj->Set( Format => 'unknown', Value => $content, Timezone => 'utc' );
- $content = $DateObj->AsString(Time => 0, Timezone => 'utc');
+ if ($m->notes('FormatDate')) {
+ $content = $m->notes('FormatDate')->($DateObj);
+ } else {
+ $content = $DateObj->AsString(Time => 0, Timezone => 'utc');
+ }
</%INIT>
<%$content|n%>
<%ARGS>
my $content = $Object->Content;
my $DateObj = RT::Date->new ( $session{'CurrentUser'} );
$DateObj->Set( Format => 'ISO', Value => $content );
- $content = $DateObj->AsString;
+ if ($m->notes('FormatDate')) {
+ $content = $m->notes('FormatDate')->($DateObj);
+ } else {
+ $content = $DateObj->AsString;
+ }
</%INIT>
<%$content|n%>
<%ARGS>
#Callbacks
$WriteHeader => sub { $RT::Logger->error('WriteHeader callback required'); '' }
$WriteRow => sub { $RT::Logger->error('WriteRow callback required'); '' }
-$FormatDate => sub { $_[0]->AsString }
</%ARGS>
<%INIT>
push @out, ProcessColumnMapValue(
$ColumnMap->{$col}{'value'},
Arguments => [ $Ticket, $row ],
- FormatDate => $FormatDate,
);
} #foreach $subcol
$value = join('', '<span>', @out, '</span>');
$row++;
};
-my $FormatDate = sub {
+$m->notes('FormatDate', sub {
my $DateObj = shift;
return '' if $DateObj->Unix == 0;
return time2str('%Y-%m-%dT%H:%M', $DateObj->Unix);
-};
+});
# Write everything to the worksheet
$m->comp('Elements/ResultsStructuredView',
Format => $Format,
WriteHeader => $WriteHeader,
WriteRow => $WriteRow,
- FormatDate => $FormatDate,
);
# Set column widths