From 52add29e0a380618a358fdbaddb612703d36eb90 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 16 Aug 2023 12:33:07 -0400 Subject: Implement localtime/UTC time display setting --- src/activitypub/apquestion.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/activitypub/apquestion.cpp') diff --git a/src/activitypub/apquestion.cpp b/src/activitypub/apquestion.cpp index d519947..06fde9e 100644 --- a/src/activitypub/apquestion.cpp +++ b/src/activitypub/apquestion.cpp @@ -1,4 +1,5 @@ #include "apquestion.h" +#include "src/settings_interface.h" #include APQuestion::APQuestion(APObjectFields fields) : APPost(fields) { @@ -18,12 +19,14 @@ QString APQuestion::get_html_render(HtmlRenderDetails render_info) { html.append(get_html_template("appoll")); if (end_time.isValid()) { - // TODO: add a UI setting for configuring the display of local time or UTC time. - html.replace("{{end-time}}", render_info.locale->toString(end_time.toLocalTime())); + html.replace("{{end-time}}", render_info.locale->toString( + SettingsInterface::quick_read_setting("ui/timezone").value() ? end_time.toUTC() : end_time.toLocalTime() + )); } if (closed_time.isValid()) { - // TODO: add a UI setting for configuring the display of local time or UTC time. - html.replace("{{closed-time}}", render_info.locale->toString(closed_time.toLocalTime())); + html.replace("{{closed-time}}", render_info.locale->toString( + SettingsInterface::quick_read_setting("ui/timezone").value() ? closed_time.toUTC() : closed_time.toLocalTime() + )); } html.replace("{{total-votes}}", render_info.locale->toString(total_votes)); -- cgit v1.2.3-54-g00ecf