Skip to content

Commit

Permalink
Merge pull request #261 from pulibrary/fix-formatted-date
Browse files Browse the repository at this point in the history
Do not extract year in formatted_date
  • Loading branch information
hackartisan authored Nov 21, 2024
2 parents 4e3ee71 + b581c8e commit 10c091b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ defmodule DpulCollections.IndexingPipeline.Figgy.HydrationCacheEntry do
end

defp format_date(%{"date_created" => [date | _tail]}) do
extract_year(date) || date
date
end

defp format_date(%{"date_created" => []}) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ defmodule DpulCollections.IndexingPipeline.Figgy.HydrationCacheEntryTest do
assert doc3[:display_date_s] == nil
assert doc4[:display_date_s] == "2011 - 2013 (approximate)"
assert doc5[:display_date_s] == nil
assert doc6[:display_date_s] == "1952"
assert doc7[:display_date_s] == "1923"
assert doc8[:display_date_s] == "2010"
assert doc9[:display_date_s] == "1954"
assert doc6[:display_date_s] == "January 26, 1952"
assert doc7[:display_date_s] == "29 Raḥab al-Marjab 1342- رحب المرجب 1342 - [July 1923]"
assert doc8[:display_date_s] == "[2010]"
assert doc9[:display_date_s] == "September [1954]"
end

test "logs dates it can't parse" do
Expand Down

0 comments on commit 10c091b

Please sign in to comment.