Closed jwoertink closed 2 years ago
Also just to note how this works because I was a little surprised...
started = 110.minutes.ago
now = Time.utc
pp (now - started).minutes #=> 50
This doesn't give you the whole time in minutes. I think it basically sees the time as 1:50:00
, and says "the minutes from this is 50".
This is an unexpected feature of the #minutes method that has caught me off guard more than once. I think #total_minutes is what you want.
oh, look at that! I didn't even know that existed. Good find @robacarp
It currently returns on hours because this is technically only 1 hour, but it ignores the other 50minutes. I would expect this to return "almost 2 hours" instead.
https://github.com/luckyframework/lucky/blob/e1a6adf8552676884e67528293d3142032387b4b/src/lucky/page_helpers/time_helpers.cr#L25
We do already make a special concession for minutes past 45 where we say "about an hour" if it's been 46minutes or more
https://github.com/luckyframework/lucky/blob/e1a6adf8552676884e67528293d3142032387b4b/src/lucky/page_helpers/time_helpers.cr#L77-L79
We could probably do the same here that if it's past X hour and 45 minutes, then just round up.