def marc_publication_date(options = {})
      estimate_tolerance  = options[:estimate_tolerance] || 15
      min_year            = options[:min_year] || 500
      max_year            = options[:max_year] || (Time.new.year + 6)

      lambda do |record, accumulator|
        date = Marc21Semantics.publication_date(record, estimate_tolerance, min_year, max_year)
        accumulator << date if date
      end
    end
def marc_publication_date(options = {})
      estimate_tolerance  = options[:estimate_tolerance] || 15
      min_year            = options[:min_year] || 500
      max_year            = options[:max_year] || (Time.new.year + 6)

      lambda do |record, accumulator|
        date = Marc21Semantics.publication_date(record, estimate_tolerance, min_year, max_year)
        accumulator << date if date
      end
    end
An opinionated algorithm for getting a SINGLE publication date out of marc

 * Prefers using 008, but will resort to 260c
 * If 008 represents a date range, will take the midpoint of the range,
     only if range is smaller than estimate_tolerance, default 15 years.
 * Ignores dates below min_year (default 500) or above max_year (this year plus 6 years),
     because experience shows too many of these were in error.

 Yeah, this code ends up ridiculous.