Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes time in unpublished revision and conflicted post dialogs #10788

Merged
merged 2 commits into from Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
@@ -1,5 +1,6 @@
13.7
-----
* Fixed time displayed on Post Conflict Detected and Unpublished Revision dialogs

13.6
-----
Expand Down
Expand Up @@ -43,7 +43,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -479,10 +478,12 @@ public static boolean hasAutoSave(PostModel post) {
public static String getConflictedPostCustomStringForDialog(PostModel post) {
Context context = WordPress.getContext();
String firstPart = context.getString(R.string.dialog_confirm_load_remote_post_body);
String lastModified =
TextUtils.isEmpty(post.getDateLocallyChanged()) ? post.getLastModified() : post.getDateLocallyChanged();
String secondPart =
String.format(context.getString(R.string.dialog_confirm_load_remote_post_body_2),
getFormattedDateForLastModified(
context, DateTimeUtils.timestampFromIso8601Millis(post.getLastModified())),
context, DateTimeUtils.timestampFromIso8601Millis(lastModified)),
getFormattedDateForLastModified(
context, DateTimeUtils.timestampFromIso8601Millis(post.getRemoteLastModified())));
return firstPart + secondPart;
Expand Down Expand Up @@ -516,10 +517,8 @@ public static String getFormattedDateForLastModified(Context context, long timeS
DateFormat.SHORT,
LocaleManager.getSafeLocale(context));


// The timezone on the website is at GMT
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
timeFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
dateFormat.setTimeZone(Calendar.getInstance().getTimeZone());
timeFormat.setTimeZone(Calendar.getInstance().getTimeZone());

return dateFormat.format(date) + " @ " + timeFormat.format(date);
}
Expand Down