Is it possible to use a guard clause and a default clause instead?
sunsetMinute = (sunsetMinute < 10 && '0' + sunsetMinute) || sunsetMinute;
Yes it is possible, but it’s busier than it really needs to be.
When using the ternary, I think that I prefer it like this:
sunsetMinute = sunsetMinute >= 10 ? sunsetMinute : '0' + sunsetMinute;
Because that’s saying that the adjustment only occurs if it’s needed.
What about if we only focus on what is being added?
sunsetMinute = (sunsetMinute >= 10 ? "" : "0") + sunsetMinute;
That one is more preferable, as it’s clearly saying that we only prepend a 0 if it’s needed.