From 9393dda9a4d41cca126866bbe5e46c8d811d2b91 Mon Sep 17 00:00:00 2001 From: ujjwal2900 <65774017+ujjwal2900@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:09:02 +0530 Subject: [PATCH] Added date and time to Feedback (#5797) * Add Date and Time in UTC format to Feedback * Add UTC date to the Subject instead of adding it to the body * Change the UTC Date format to yyyy/MM/dd HH:mm:ss * Minor changes --------- Co-authored-by: Nicolas Raoul --- .../nrw/commons/feedback/FeedbackContentCreator.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/fr/free/nrw/commons/feedback/FeedbackContentCreator.java b/app/src/main/java/fr/free/nrw/commons/feedback/FeedbackContentCreator.java index 839858b3e..1723da723 100644 --- a/app/src/main/java/fr/free/nrw/commons/feedback/FeedbackContentCreator.java +++ b/app/src/main/java/fr/free/nrw/commons/feedback/FeedbackContentCreator.java @@ -6,6 +6,9 @@ import fr.free.nrw.commons.auth.AccountUtil; import fr.free.nrw.commons.feedback.model.Feedback; import fr.free.nrw.commons.utils.LangCodeUtils; import java.util.Locale; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; /** * Creates a wikimedia recognizable format @@ -32,11 +35,19 @@ public class FeedbackContentCreator { /* * Construct the feedback section title */ + + //Get the UTC Date and Time and add it to the Title + final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ENGLISH); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + final String UTC_FormattedDate = dateFormat.format(new Date()); + sectionTitleBuilder = new StringBuilder(); sectionTitleBuilder.append("Feedback from "); sectionTitleBuilder.append(AccountUtil.getUserName(context)); sectionTitleBuilder.append(" for version "); sectionTitleBuilder.append(feedback.getVersion()); + sectionTitleBuilder.append(" on "); + sectionTitleBuilder.append(UTC_FormattedDate); /* * Construct the feedback section text @@ -96,6 +107,7 @@ public class FeedbackContentCreator { } sectionTextBuilder.append("~~~~"); sectionTextBuilder.append("\n"); + } public String getSectionText() {