Commit 63e884a4 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Commit Bot

[Autofill Assistant] Fix Details date.

Before this patch, we were instantiating a date using the java.util.Date
constructor, which is deprecated and required us to decrement the year
by 1900.

This patch is using the recommended Calendar class instead.

Bug: 806868
Change-Id: Id723c3ee8a1abc602f179c0924782c17d123c06b
Reviewed-on: https://chromium-review.googlesource.com/c/1297136
Commit-Queue: Jordan Demeulenaere <jdemeulenaere@chromium.org>
Reviewed-by: default avatarStephane Zermatten <szermatt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602312}
parent be0dadf1
......@@ -23,6 +23,7 @@ import org.chromium.content_public.browser.WebContents;
import org.chromium.payments.mojom.PaymentOptions;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
......@@ -235,8 +236,10 @@ public class AutofillAssistantUiController implements AutofillAssistantUiDelegat
int day, int hour, int minute, int second) {
Date date = null;
if (year > 0 && month > 0 && day > 0 && hour >= 0 && minute >= 0 && second >= 0) {
Calendar calendar = Calendar.getInstance();
// Month in Java Date is 0-based, but the one we receive from the server is 1-based.
date = new Date(year, month - 1, day, hour, minute, second);
calendar.set(year, month - 1, day, hour, minute, second);
date = calendar.getTime();
}
mUiDelegate.showDetails(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment