Invidious is an alternative front-end to YouTube
Add support for 'seconds' in decode_date
Omar Roth2c4a3b19e259
diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.crindex 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_icase date[1]+ when .includes? "second"+ delta = delta.secondswhen .includes? "minute"delta = delta.minuteswhen .includes? "hour"@@ -105,8 +107,10 @@ def recode_date(time : Time)span = {span.total_days, "day"}elsif span.total_minutes > 60.0span = {span.total_hours, "hour"}+ elsif span.total_seconds > 60.0+ span = {span.total_minutes, "minute"}else- span = {0, "units"}+ span = {span.total_seconds, "second"}endspan = {span[0].to_i, span[1]}