+ my $params = shift;
+ my ( $dt, $force_pref, $force_time, $dateonly );
+ if ( ref $params eq 'HASH' ) {
+ $dt = $params->{dt};
+ $force_pref = $params->{dateformat}; # if testing we want to override Context
+ $force_time = $params->{timeformat};
+ $dateonly = $params->{dateonly} || 0; # if you don't want the hours and minutes
+ } else {
+ $dt = $params;
+ }
+
+ return unless defined $dt;
+
+ $dt->set_time_zone( C4::Context->tz );
+