module Feedjira::DateTimeUtilities
Constants
- DATE_PARSERS
This is our date parsing heuristic.
Date
Parsers are attempted in order.
Public Instance Methods
parse_datetime(string)
click to toggle source
Parse the given string starting with the most common parser (default ruby) and going over all other available parsers
# File lib/feedjira/date_time_utilities.rb, line 16 def parse_datetime(string) res = DATE_PARSERS.detect do |parser| return parser.parse(string).feed_utils_to_gm_time rescue StandardError => e Feedjira.logger.debug { "Failed to parse date #{string}" } Feedjira.logger.debug(e) nil end Feedjira.logger.warn { "Failed to parse date #{string}" } if res.nil? res end