mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add support for 'seconds' in decode_date
This commit is contained in:
parent
9cd193f108
commit
2c4a3b19e2
1 changed files with 5 additions and 1 deletions
|
@ -73,6 +73,8 @@ def decode_date(string : String)
|
||||||
delta = date[0].to_i
|
delta = date[0].to_i
|
||||||
|
|
||||||
case date[1]
|
case date[1]
|
||||||
|
when .includes? "second"
|
||||||
|
delta = delta.seconds
|
||||||
when .includes? "minute"
|
when .includes? "minute"
|
||||||
delta = delta.minutes
|
delta = delta.minutes
|
||||||
when .includes? "hour"
|
when .includes? "hour"
|
||||||
|
@ -105,8 +107,10 @@ def recode_date(time : Time)
|
||||||
span = {span.total_days, "day"}
|
span = {span.total_days, "day"}
|
||||||
elsif span.total_minutes > 60.0
|
elsif span.total_minutes > 60.0
|
||||||
span = {span.total_hours, "hour"}
|
span = {span.total_hours, "hour"}
|
||||||
|
elsif span.total_seconds > 60.0
|
||||||
|
span = {span.total_minutes, "minute"}
|
||||||
else
|
else
|
||||||
span = {0, "units"}
|
span = {span.total_seconds, "second"}
|
||||||
end
|
end
|
||||||
|
|
||||||
span = {span[0].to_i, span[1]}
|
span = {span[0].to_i, span[1]}
|
||||||
|
|
Loading…
Reference in a new issue