This is an attempt to prevent wraparound in narrow contexts, which can cause layout issues in the player cards on the Game page. See discussion/poll at OGF: Should time control show days without hours?
To summarize, the "6d 3h" format the overwhelming preference (93%) in the multiple choice poll. One user cited precision as a reason for choosing this over an option like "6 Days" that keeps long-form units, but drops hours. Another user pointed out that the Sente Android app uses this format.
Proposed Changes
I've broken this into four commits:
One basic component test (~66% coverage of the file)
In depth test of prettyTime() (100% coverage of the function)
Clean up prettyTime() a bit (no functional changes)
Change the output for days > 1 && hours > 0
Screenshots
Notice, we get one line of vertical space back on both the player cards and the active games list. This is critical for phone screens!
This is an attempt to prevent wraparound in narrow contexts, which can cause layout issues in the player cards on the Game page. See discussion/poll at OGF: Should time control show days without hours?
To summarize, the "6d 3h" format the overwhelming preference (93%) in the multiple choice poll. One user cited precision as a reason for choosing this over an option like "6 Days" that keeps long-form units, but drops hours. Another user pointed out that the Sente Android app uses this format.
Proposed Changes
I've broken this into four commits:
prettyTime()
(100% coverage of the function)prettyTime()
a bit (no functional changes)days > 1 && hours > 0
Screenshots
Notice, we get one line of vertical space back on both the player cards and the active games list. This is critical for phone screens!