Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse datetime in a full string #377

Open
arjunmenon opened this issue Jun 26, 2018 · 1 comment
Open

Parse datetime in a full string #377

arjunmenon opened this issue Jun 26, 2018 · 1 comment
Labels

Comments

@arjunmenon
Copy link

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 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.

@davispuh
Copy link
Collaborator

It's not really supported, it kinda works for some texts/cases but if text contains any keyword it most likely will be parsed wrongly.

If you remove from and one from this text then it will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants