diff --git a/servehelper.cpp b/servehelper.cpp index caaf5b9..aa7e923 100644 --- a/servehelper.cpp +++ b/servehelper.cpp @@ -472,6 +472,8 @@ static inline Element serialize_media(const Media& media) { } static inline Element serialize_poll(const httplib::Request& req, const Poll& poll) { + using namespace std::string_literals; + uint64_t voters_count = poll.voters_count >= 0 ? static_cast(poll.voters_count) : poll.votes_count; Element div("div"); @@ -496,10 +498,13 @@ static inline Element serialize_poll(const httplib::Request& req, const Poll& po : std::vector({std::to_string(poll.votes_count), " ", pick_form(poll.votes_count, "vote", "votes")}) ); if (poll.expired) { - p.nodes.push_back(" / Expired"); + p.nodes.push_back(" / "); + p.nodes.push_back(Element("time", {{"datetime", to_rfc3339(poll.expires_at)}, {"title", "Expired on "s + full_time(poll.expires_at)}}, {"Expired"})); } else if (poll.expires_at >= 0) { - p.nodes.push_back(" / Expires in "); - p.nodes.push_back(relative_time(current_time(), poll.expires_at)); + p.nodes.push_back(" / "); + p.nodes.push_back(Element("time", {{"datetime", to_rfc3339(poll.expires_at)}, {"title", full_time(poll.expires_at)}}, { + "Expires in ", relative_time(current_time(), poll.expires_at), + })); } div.nodes.push_back(std::move(p));