From a5c4efdde055d3dbaf6694278224af71af41283d Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Tue, 23 Apr 2024 10:03:19 +0100
Subject: [PATCH] Bug 36535: (QA follow-up) Use dt_from_string

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 t/db_dependent/api/v1/biblios.t | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/t/db_dependent/api/v1/biblios.t b/t/db_dependent/api/v1/biblios.t
index 946f5806971..554894bdd12 100755
--- a/t/db_dependent/api/v1/biblios.t
+++ b/t/db_dependent/api/v1/biblios.t
@@ -210,13 +210,14 @@ subtest 'get_items() tests' => sub {
             {
                 class => 'Koha::Patrons',
                 value => {
-                    flags        => 1,
+                    flags => 1,
                 }
             }
         );
         $patron->set_password( { password => $password, skip_validation => 1 } );
-        my $userid         = $patron->userid;
-        my $pickup_library = $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
+        my $userid = $patron->userid;
+        my $pickup_library =
+            $builder->build_object( { class => 'Koha::Libraries', value => { pickup_location => 1 } } );
 
         my $item = $builder->build_sample_item;
         my $data = {
@@ -224,14 +225,20 @@ subtest 'get_items() tests' => sub {
             biblio_id         => $item->biblionumber,
             item_id           => $item->itemnumber,
             pickup_library_id => $pickup_library->branchcode,
-            expiration_date   => output_pref( { dt => DateTime->now->add(days => "3")->truncate(to => 'day'), dateformat => 'iso', dateonly => 1 } ),
+            expiration_date   => output_pref(
+                {
+                    dt       => dt_from_string()->add( days => "3" )->truncate( to => 'day' ), dateformat => 'iso',
+                    dateonly => 1
+                }
+            ),
         };
         $t->post_ok( "//$userid:$password@/api/v1/holds" => json => $data )->status_is(201)->json_has('/hold_id');
 
         $t->get_ok( "//$userid:$password@/api/v1/biblios/"
                 . $item->biblionumber
                 . "/items" => { "x-koha-embed" => "first_hold+strings" } )->status_is(200)
-            ->json_is( '/0/first_hold/_strings/pickup_library_id' => { type => 'library', str => $pickup_library->branchname } );
+            ->json_is(
+            '/0/first_hold/_strings/pickup_library_id' => { type => 'library', str => $pickup_library->branchname } );
     };
 
     $schema->storage->txn_rollback;
-- 
2.44.0