hatepoint / phrases-hyperskill-tests

0 stars 1 forks source link

improve time display format #13

Closed RedJocker closed 1 year ago

RedJocker commented 1 year ago

Currently there is no zero-padding on string that displays time, if a time like mid-night is picked then it will be displayed as 0:0. At least the minutes should have zero-padding 0:00, or it may be both 00:00.

on solution this is handled on this line: https://github.com/hatepoint/phrases-hyperskill-tests/blob/deb6d7f3a4effb2373364c06e318d60468ad982b/Phrases/stage3/src/main/java/org/hyperskill/phrases/MainActivity.kt#L84

which could become something like this bellow to have zeropadding on both hours and minutes:

binding.reminderTextView.text = "Reminder set for %02d%02d".format(hour, minute) 

Test could test cases with one digit number on hours only, on minutes only and on both. So something like 00:00, 09:50, 13:09 could be interesting cases.

Another thing that should be more well defined on description and tested by tests is the choice of format between am/pm or 24 hour clock. Currently solution uses 24hour clock, so one minute to midnight is 23:59. The easiest choice here is to require the 24hour clock format and make a testcase that test sometime after noon. The hardest choice here would be to require support for both using SharedPreferences and have some settings handled on toolbar. For lack of time I don't recommend the hardest choice although it could be something interesting to handle on a project.

hatepoint commented 1 year ago

I think I might add this as an objective. Something like "format the time correctly" would be nice and testing this shouldn't be a problem at all

I wouldn't go for the hardest solution: I think it's a better idea to experiment with a projects where we're not limited in time

hatepoint commented 1 year ago

ddaddcf445a7c0c222ded11ef95c39b1ab3ed3c5