From 4473a823403d4fa52dbe00acf05f397c3ba5da5d Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 28 Feb 2020 06:59:42 +0000 Subject: [PATCH] Bug 10662: Strip UTC designators from header_datestamp --- Koha/OAI/Harvester/Import/Record.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Koha/OAI/Harvester/Import/Record.pm b/Koha/OAI/Harvester/Import/Record.pm index 2e672cd8a5..6d29795128 100755 --- a/Koha/OAI/Harvester/Import/Record.pm +++ b/Koha/OAI/Harvester/Import/Record.pm @@ -73,7 +73,9 @@ sub new { my $xpath_datestamp = XML::LibXML::XPathExpression->new("oai:header/oai:datestamp"); my $datestamp = $xpc->findnodes($xpath_datestamp,$root)->shift; - $args->{header_datestamp} = $datestamp->textContent; + if ($datestamp && $datestamp->textContent){ + $args->{header_datestamp} = _strip_UTC_designators($datestamp->textContent); + } my $xpath_status = XML::LibXML::XPathExpression->new(q{oai:header/@status}); my $status_node = $xpc->findnodes($xpath_status,$root)->shift; @@ -345,4 +347,11 @@ sub delete_koha_record { return $action; } +sub _strip_UTC_designators { + my ( $timestamp ) = @_; + $timestamp =~ s/T/ /g; + $timestamp =~ s/Z//g; + return $timestamp; +} + 1; -- 2.11.0