"17 hours ago ... The Twitter account, which rates images of dogs, changed one canine's name from Kanan to George, drawing criticism. "
Now this string has "17 hours ago" which on its own gets parsed but not with the full string, which return a nil.
Alternatively, if I do a to_time, from the Rails Datetime class, on it - it gets parsed to 2018-06-27 17:00:00 +0530, a datetime object but is not at all accurate. (I ran this at dot midnight, it simply returned 1700 to the current date)
Even though Datetime tried to find strings which can represent dates or times, but the Datetime class is too too forgiving. It becomes inaccurate.
So how can we make chronic find patterns of string which it knows represent datetime, from full strings? This should be possible.
Hey I am trying to parse datetime from a string.
"17 hours ago ... The Twitter account, which rates images of dogs, changed one canine's name from Kanan to George, drawing criticism. "
Now this string has "17 hours ago" which on its own gets parsed but not with the full string, which return a
nil
.Alternatively, if I do a
to_time
, from the Rails Datetime class, on it - it gets parsed to2018-06-27 17:00:00 +0530
, a datetime object but is not at all accurate. (I ran this at dot midnight, it simply returned 1700 to the current date)Even though Datetime tried to find strings which can represent dates or times, but the Datetime class is too too forgiving. It becomes inaccurate.
So how can we make chronic find patterns of string which it knows represent datetime, from full strings? This should be possible.