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

No error thrown when using --at with a typo #127

Open
marcaddeo opened this issue Mar 16, 2016 · 2 comments
Open

No error thrown when using --at with a typo #127

marcaddeo opened this issue Mar 16, 2016 · 2 comments

Comments

@marcaddeo
Copy link
Contributor

For example, if you try to do timetrap in --at "15 minutes aog" it interprets it strangely and you'll end up with 100 hours logged on the entry.

Is there any way to combat this? Or is this just a bug/limitation of the underlying string -> time transformation library?

@samg
Copy link
Owner

samg commented Mar 16, 2016

Yeah, it's tricky to implement timetrap in a way to avoid this kind of unexpected behavior while allowing the same level of flexibility in what users can input. (Also a lot is dependent on the underlying behavior of the chronic gem and Time.parse.) There's some discussion of this class of issue at #10. Basically I've never been able to figure out a clear way to detect these kinds of user errors and avoid passing them into the underlying libraries. If you have suggestions let me know.

@samg
Copy link
Owner

samg commented Mar 16, 2016

Also, for reference, here's where the logic for parsing user provided time strings lives:

https://github.com/samg/timetrap/blob/master/lib/timetrap/timer.rb#L13-L32

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

No branches or pull requests

2 participants