Class: Dates::DateFormatter
- Inherits:
-
Object
- Object
- Dates::DateFormatter
- Defined in:
- lib/docfolio/paragraph_modules/dates.rb
Overview
Extracts a date in seconds past UNIX epoc from a string date. The result can be used for other date operations. Converts from dd-mmm-yy and similar formats as commonly found in csv files
Instance Method Summary collapse
Instance Method Details
#format_date(date) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/docfolio/paragraph_modules/dates.rb', line 8 def format_date(date) day, month, year = components(date) begin Time.new(year, month, day).to_i rescue ArgumentError => e print_argument_error_msg(e) return nil rescue => e raise e end end |