hours
hours copied to clipboard
add command - automatically detect --to am/pm
Given:
- I am using a 12 hour clock format
- I call the
addcommand - I specify the
--fromoption with am or pm - I don't specify am or pm for the
--tooption
...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).