Skip to content

Commit 9393dda

Browse files
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 <nicolas.raoul@gmail.com>
1 parent c3cd30c commit 9393dda

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/src/main/java/fr/free/nrw/commons/feedback/FeedbackContentCreator.java

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import fr.free.nrw.commons.feedback.model.Feedback;
77
import fr.free.nrw.commons.utils.LangCodeUtils;
88
import java.util.Locale;
9+
import java.text.SimpleDateFormat;
10+
import java.util.Date;
11+
import java.util.TimeZone;
912

1013
/**
1114
* Creates a wikimedia recognizable format
@@ -32,11 +35,19 @@ public void init() {
3235
/*
3336
* Construct the feedback section title
3437
*/
38+
39+
//Get the UTC Date and Time and add it to the Title
40+
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ENGLISH);
41+
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
42+
final String UTC_FormattedDate = dateFormat.format(new Date());
43+
3544
sectionTitleBuilder = new StringBuilder();
3645
sectionTitleBuilder.append("Feedback from ");
3746
sectionTitleBuilder.append(AccountUtil.getUserName(context));
3847
sectionTitleBuilder.append(" for version ");
3948
sectionTitleBuilder.append(feedback.getVersion());
49+
sectionTitleBuilder.append(" on ");
50+
sectionTitleBuilder.append(UTC_FormattedDate);
4051

4152
/*
4253
* Construct the feedback section text
@@ -96,6 +107,7 @@ public void init() {
96107
}
97108
sectionTextBuilder.append("~~~~");
98109
sectionTextBuilder.append("\n");
110+
99111
}
100112

101113
public String getSectionText() {

0 commit comments

Comments
 (0)