diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-08-07 08:10:24 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-08-07 08:10:24 -0500 |
| commit | 2c4a3b19e259b62dce49dfe6492131c3139d6762 (patch) | |
| tree | 55daa35a76a51c520676b8fdd533169667db1830 | |
| parent | 9cd193f108a0bfbc3763e992925fa9b0ac255120 (diff) | |
| download | invidious-2c4a3b19e259b62dce49dfe6492131c3139d6762.tar.gz invidious-2c4a3b19e259b62dce49dfe6492131c3139d6762.tar.bz2 invidious-2c4a3b19e259b62dce49dfe6492131c3139d6762.zip | |
Add support for 'seconds' in decode_date
| -rw-r--r-- | src/invidious/helpers/utils.cr | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index 3a9003da..db49bab0 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -73,6 +73,8 @@ def decode_date(string : String) delta = date[0].to_i case date[1] + when .includes? "second" + delta = delta.seconds when .includes? "minute" delta = delta.minutes when .includes? "hour" @@ -105,8 +107,10 @@ def recode_date(time : Time) span = {span.total_days, "day"} elsif span.total_minutes > 60.0 span = {span.total_hours, "hour"} + elsif span.total_seconds > 60.0 + span = {span.total_minutes, "minute"} else - span = {0, "units"} + span = {span.total_seconds, "second"} end span = {span[0].to_i, span[1]} |
