Skip to content

Commit

Permalink
Merge pull request #14 from duke-libraries/approximate-interval-fix
Browse files Browse the repository at this point in the history
Display approximate prefix for "to" date in interval; Fixes #13
  • Loading branch information
corylown authored Sep 28, 2016
2 parents dea0b01 + 84ddeee commit 79f3f97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/edtf/humanize/interval.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ module Interval
include Edtf::Humanize::Formats

def humanize
"#{apply_if_approximate(self.from)}#{simple_date_format(self.from)}#{Edtf::Humanize.configuration.interval_connector}#{simple_date_format(self.to)}"
"#{apply_if_approximate(self.from)}"\
"#{simple_date_format(self.from)}"\
"#{Edtf::Humanize.configuration.interval_connector}"\
"#{apply_if_approximate(self.to)}"\
"#{simple_date_format(self.to)}"\
end

private
Expand Down
2 changes: 1 addition & 1 deletion test/edtf_humanize_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HumanizeIntervalTest < ActiveSupport::TestCase
class HumanizeApproximateIntervalTest < ActiveSupport::TestCase
test "should return a humanized approximate interval string" do
d = Date.edtf('1970~/1980~')
assert_equal "circa 1970 to 1980", d.humanize
assert_equal "circa 1970 to circa 1980", d.humanize
end
end

Expand Down

0 comments on commit 79f3f97

Please sign in to comment.