Bug 17755: Introduce Koha::Object::Limit::Library
[srvgit] / Koha / DateUtils.pm
index 65afaea..51d3d93 100644 (file)
@@ -22,7 +22,6 @@ use C4::Context;
 use Carp;
 
 use base 'Exporter';
-use version; our $VERSION = qv('1.0.0');
 
 our @EXPORT = (
     qw( dt_from_string output_pref format_sqldatetime )
@@ -214,8 +213,11 @@ sub output_pref {
         and return
             if $dt and $str;
 
-    $dt = eval { dt_from_string( $str ) } if $str;
-    carp "Invalid date '$str' passed to output_pref\n" if $@;
+    if ( $str ) {
+        local $@;
+        $dt = eval { dt_from_string( $str ) };
+        carp "Invalid date '$str' passed to output_pref\n" if $@;
+    }
 
     return unless defined $dt;