Module: Spix::Parser::DateTimeUtilities
Instance Method Summary collapse
Instance Method Details
#build_datetime_object(timestamp) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/spix_parser/datetime.rb', line 5 def build_datetime_object() = () if Time.can_parse?() #if the timestamp is a non-date string, it will be Time.mktime("1970").utc = Time.parse(, Spix::Parser::Config::BASE_TIMESTAMP).utc # non-english dates sometimes are parsed to "future" dates by Ruby # we also cover the case where the timestamp is Time.mktime("1970").utc as explained above if ( > Time.now.utc) || ( == Spix::Parser::Config::BASE_TIMESTAMP) = nil end else = nil end end |