hours icon indicating copy to clipboard operation
hours copied to clipboard

add command - automatically detect --to am/pm

Open matt-allan opened this issue 6 years ago • 0 comments

Given:

  • I am using a 12 hour clock format
  • I call the add command
  • I specify the --from option with am or pm
  • I don't specify am or pm for the --to option

...then the to date should default to the closest possible time.

For example, when I specify --from '8:00 pm' --to '9:00' the to time becomes 9:00 am:

$ php hours add blog --from '8:00 pm' --to '9:00'
Added frame for blog from May 6, 2019 8:00 pm to May 6, 2019 9:00 am (11 hours).

...it's safe to assume I probably meant 9:00 pm and I only worked one hour rather than working through the night. If this feature was implemented I would see this instead:

$ php hours add blog --from '8:00 pm' --to '9:00'
Added frame for blog from May 6, 2019 8:00 pm to May 6, 2019 9:00 pm (1 hour).

We don't want to default to the start time's am/pm designation as that results in unexpected behavior when starting work just before noon, i.e.

$ php hours add blog --from '11:00 am' --to '1:00'   
Added frame for blog from May 6, 2019 11:00 am to May 6, 2019 1:00 am (10 hours).

matt-allan avatar May 06 '19 14:05 matt-allan