|
16 | 16 | import java.sql.SQLException; |
17 | 17 | import java.time.Instant; |
18 | 18 | import java.time.LocalDate; |
| 19 | +import java.time.ZoneId; |
19 | 20 | import java.time.format.DateTimeFormatter; |
20 | 21 | import java.time.format.DateTimeParseException; |
21 | 22 | import java.util.ArrayList; |
@@ -1083,13 +1084,13 @@ public static LocalDate parseDate(String date) { |
1083 | 1084 |
|
1084 | 1085 |
|
1085 | 1086 | /** |
1086 | | - * Take the date object and convert it into a string of the form YYYY-MM-DD |
| 1087 | + * Take the date object and convert it into an Instant datetime object of the form YYYY-MM-DDTHH:MM:SSZ |
1087 | 1088 | * |
1088 | 1089 | * @param date the date to be converted |
1089 | | - * @return A string of the form YYYY-MM-DD |
| 1090 | + * @return An Instant datetime object of the form YYYY-MM-DDTHH:MM:SSZ |
1090 | 1091 | */ |
1091 | | - public static String unParseDate(LocalDate date) { |
1092 | | - return DateTimeFormatter.ISO_LOCAL_DATE.format(date); |
| 1092 | + public static Instant convertDate(LocalDate date) { |
| 1093 | + return date.atStartOfDay(ZoneId.systemDefault()).toInstant(); |
1093 | 1094 | } |
1094 | 1095 |
|
1095 | 1096 |
|
@@ -1219,13 +1220,13 @@ public static Integer getNumItems(Context context, String type) |
1219 | 1220 | StringBuilder accessionedQuery = new StringBuilder(); |
1220 | 1221 | accessionedQuery.append("dc.date.accessioned_dt:["); |
1221 | 1222 | if (startDate != null) { |
1222 | | - accessionedQuery.append(unParseDate(startDate)); |
| 1223 | + accessionedQuery.append(convertDate(startDate)); |
1223 | 1224 | } else { |
1224 | 1225 | accessionedQuery.append("*"); |
1225 | 1226 | } |
1226 | 1227 | accessionedQuery.append(" TO "); |
1227 | 1228 | if (endDate != null) { |
1228 | | - accessionedQuery.append(unParseDate(endDate)); |
| 1229 | + accessionedQuery.append(convertDate(endDate)); |
1229 | 1230 | } else { |
1230 | 1231 | accessionedQuery.append("*"); |
1231 | 1232 | } |
|
0 commit comments