Skip to content

Commit

Permalink
Added date and time to Feedback (commons-app#5797)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
2 people authored and rohit9625 committed Sep 13, 2024
1 parent d18239f commit 3ac2282
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
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
Expand All @@ -32,11 +35,19 @@ public void init() {
/*
* 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
Expand Down Expand Up @@ -96,6 +107,7 @@ public void init() {
}
sectionTextBuilder.append("~~~~");
sectionTextBuilder.append("\n");

}

public String getSectionText() {
Expand Down

0 comments on commit 3ac2282

Please sign in to comment.