module EPUBInfo::Utils

Public Class Methods

parse_iso_8601_date(date_str) click to toggle source
# File lib/epubinfo/utils.rb, line 3
def self.parse_iso_8601_date(date_str)
  case date_str.count('-')
  when 0
    Date.strptime(date_str, '%Y')
  when 1
    Date.strptime(date_str, '%Y-%m')
  when 2
    Date.strptime(date_str, '%Y-%m-%d')
  end
end