Sha256: 50339b7bd6561b165a98cd254f2d8260ef849c0a2d439cea1c270132509eacd4

Contents?: true

Size: 296 Bytes

Versions: 1

Compression:

Stored size: 296 Bytes

Contents

module EPUBInfo
  module Utils
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epubinfo-0.3.3 lib/epubinfo/utils.rb