Method: BarkestCore::DateParser.parse_for_date_column
- Defined in:
- lib/barkest_core/concerns/date_parser.rb
.parse_for_date_column(value) ⇒ Object
Parses a value for storage in a date/datetime column.
Value should be a string in ‘M/D/YYYY’ or ‘YYYY-MM-DD’ format but can also be a Date or Time object.
Returns a Time object or nil if value is invalid.
47 48 49 |
# File 'lib/barkest_core/concerns/date_parser.rb', line 47 def self.parse_for_date_column(value) Time.utc_parse(value).date rescue nil end |