Dates.pm: Added functions format_date and format_date_in_iso as possible drop-in replacements for

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Joe Atzberger 2007-10-16 16:02:28 -05:00 committed by Joshua Ferraro
parent eac81e3d8b
commit b73e4e924e

View file

@ -24,7 +24,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
$VERSION = 0.03;
@ISA = qw(Exporter);
@EXPORT_OK = qw(DHTMLcalendar);
@EXPORT_OK = qw(DHTMLcalendar format_date_in_iso format_date);
my $prefformat = C4::Context->preference('dateformat');
my $debug = $ENV{'DEBUG'} || 0;
@ -132,6 +132,14 @@ sub visual {
return $format_map{ eval { $self->{'dateformat'} } || $prefformat} ;
}
# like the functions from the old C4::Date.pm
sub format_date {
return __PACKAGE__ -> new(shift,'iso')->output((@_) ? shift : $prefformat);
}
sub format_date_in_iso {
return __PACKAGE__ -> new(shift,$prefformat)->output('iso');
}
1;
__END__