samg / timetrap

Simple command line timetracker
http://rubygems.org/gems/timetrap
Other
1.48k stars 116 forks source link

at flag should use today's date #91

Open phantomwhale opened 10 years ago

phantomwhale commented 10 years ago

This evening, I realised I forgot to track a couple of hours in the morning on an ongoing project, so typed

t resume -a 08:15 t out -a 10:15

But this added them as entries for TOMORROW morning ? Any reason why it does this, rather than use today's date ?

samg commented 10 years ago

I believe the current behavior is to choose the time closest to the current time when there's ambiguity (e.g. if it's 9:15pm choose 10:15pm one hour in the future instead of 10:15am 11 hours in the past). For cases where this isn't the desired behavior you'd need to be more explicit (e.g. "today 10:15 am")

See https://github.com/samg/timetrap/blob/master/lib/timetrap/timer.rb#L34-L39 for the spot this is implemented.

Let me know if this isn't the behavior you're observing or if you have suggestions on how to improve it.

phantomwhale commented 10 years ago

I guess I personally expected it to use today's date, by default, no matter what time I entered.

I also thought I entered those times I gave above late in the evening (around midnight), so would have thought they would have gone back 2-4 hours, rather than forward 8-10 hours from what you are suggesting ? But it was a while ago, so I cannot be sure if that's exactly what happened.

I've learned the ways of specifiying date and AM/PM now, so it's less of an issue as I get more comfortable with the tool, but from my perspective (and I understand it's just MY perspective !) the expectation above was the "least surprising" behavior