LostRhapsody / slothtime

Minimalist time tracking website
https://slothtime.dev
GNU General Public License v3.0
0 stars 0 forks source link

Time Entry Improvements - Account for 3 digit entries #42

Closed LostRhapsody closed 1 year ago

LostRhapsody commented 1 year ago

When entering only three digits, such as 445 to represent 4:45 pm, currently we assume it's the 44:5, with the final 0 missing. This gets formatted to 12:05, 12 being the automatic value to set for any time greater than 24hrs, and 5 being because we had a 5 but no additional 0, so it happens one to the start of the minutes.

The minutes formatting is handled under another issue. This is for 3-digit entries specifically.

Before performing any string manipulation, just check the length. If it equals 3 with no colon (:) or 4 with a colon, assume it's 1 hour digit and 2 minute digits.

This way we format it like so: prefix the hour digit with a zero, assume the minutes are correct as is. At this step there should be 4 digits, or 5 digits if a colon was used, and we can continue with the regular formatting logic as usual.

LostRhapsody commented 1 year ago

Closed under 540e5dfabd0da46930976a280ec6510fa1195bc0.