mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:25:56 -04:00
Changed Unix time to Rfc3339 time and removed NaN message
This commit is contained in:
parent
e8cd631b2d
commit
b526f48120
@ -247,9 +247,9 @@ module Invidious::JSONify::APIv1
|
|||||||
json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64
|
json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64
|
||||||
json.field "published", rv["published"]?
|
json.field "published", rv["published"]?
|
||||||
if !rv["published"].nil?
|
if !rv["published"].nil?
|
||||||
json.field "publishedText", translate(locale, "`x` ago", recode_date(Time.unix(rv["published"].to_i), locale))
|
json.field "publishedText", translate(locale, "`x` ago", recode_date(Time.parse_rfc3339(rv["published"].to_s), locale))
|
||||||
else
|
else
|
||||||
json.field "publishedText", translate(locale, "`x` ago", "NaN")
|
json.field "publishedText", ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -38,7 +38,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
|
|||||||
|
|
||||||
if published_time_text = related["publishedTimeText"]?
|
if published_time_text = related["publishedTimeText"]?
|
||||||
decoded_time = decode_date(published_time_text["simpleText"].to_s)
|
decoded_time = decode_date(published_time_text["simpleText"].to_s)
|
||||||
published = decoded_time.to_unix.to_s
|
published = decoded_time.to_rfc3339.to_s
|
||||||
else
|
else
|
||||||
published = nil
|
published = nil
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user