Changed Unix time to Rfc3339 time and removed NaN message

This commit is contained in:
RadoslavL 2024-08-16 23:57:49 +03:00
parent e8cd631b2d
commit b526f48120
2 changed files with 3 additions and 3 deletions

View File

@ -247,9 +247,9 @@ module Invidious::JSONify::APIv1
json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64
json.field "published", rv["published"]?
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
json.field "publishedText", translate(locale, "`x` ago", "NaN")
json.field "publishedText", ""
end
end
end

View File

@ -38,7 +38,7 @@ def parse_related_video(related : JSON::Any) : Hash(String, JSON::Any)?
if published_time_text = related["publishedTimeText"]?
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
published = nil
end