Class: Formatters::DateFormatter
- Inherits:
-
Object
- Object
- Formatters::DateFormatter
- Defined in:
- lib/formatters/date_formatter.rb
Class Method Summary collapse
Class Method Details
.format_date(date_to_format, format = :iso8601) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/formatters/date_formatter.rb', line 8 def self.format_date(date_to_format, format = :iso8601) return if date_to_format.nil? begin Date.parse(date_to_format.to_s).to_formatted_s(format) rescue ArgumentError Rails.logger.error "[Formatters/DateFormatter] Cannot parse given date: #{date_to_format}" nil end end |