Skip to content

Commit

Permalink
Merge pull request #143 from sul-dlss/unknown
Browse files Browse the repository at this point in the history
Treat [uuuu] as an invalid date.
  • Loading branch information
edsu authored Oct 9, 2023
2 parents 032f78e + 2a0cd0b commit b23270d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/stanford-mods.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'active_support'
require 'active_support/core_ext/integer/inflections'
require 'active_support/core_ext/object/blank'
require 'mods'
require 'stanford-mods/coordinate'
require 'stanford-mods/imprint'
Expand Down
4 changes: 2 additions & 2 deletions lib/stanford-mods/imprint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def initialize(value)

# True if the element text isn't blank or the placeholder "9999".
def valid?
text.present? && !['9999', '0000-00-00', 'uuuu'].include?(text.strip)
text.present? && !['9999', '0000-00-00', 'uuuu', '[uuuu]'].include?(text.strip)
end

def key_date?
Expand All @@ -161,7 +161,7 @@ def parsed_date?

def sort_key
return unless date

year = if date.is_a?(EDTF::Interval)
date.from.year
else
Expand Down
3 changes: 3 additions & 0 deletions spec/imprint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def stanford_mods_imprint(smods_rec)
<dateIssued>
uuuu
</dateIssued>
<dateIssued>
[uuuu]
</dateIssued>
<dateIssued>
0000-00-00
</dateIssued>' +
Expand Down

0 comments on commit b23270d

Please sign in to comment.