Open marcaddeo opened 8 years ago
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 https://github.com/samg/timetrap/issues/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.
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
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?