Commit 66d1c818 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Default date picker to latest available date.

Implements #30260.
parent 53e94d8c
# Changes in version 4.?.? - 2020-0?-??
* Medium changes
- Default date picker to latest available date.
* Minor changes
- Improve logging of the database importer.
- Simplify logging configuration.
......
......@@ -16,6 +16,7 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URL;
import java.time.LocalDate;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -150,12 +151,15 @@ public class ExoneraTorServlet extends HttpServlet {
? (baseUrl + requestUri) : request.getRequestURL().toString();
/* Write form. */
String defaultDateString = LocalDate.now(ZoneOffset.UTC)
.minusDays(2).toString();
boolean timestampOutOfRange = requestedDate.valid
&& (firstDate.valid && requestedDate.date.isBefore(firstDate.date)
|| (lastDate.valid && requestedDate.date.isAfter(lastDate.date)));
this.writeForm(out, rb, relayIp, relayIpHasError
|| ("".equals(relayIp) && !requestedDate.empty),
requestedDate.asString, !relayIpHasError
requestedDate.valid ? requestedDate.asString : defaultDateString,
!relayIpHasError
&& !("".equals(relayIp) && !requestedDate.valid)
&& (!requestedDate.valid || timestampOutOfRange
|| (!"".equals(relayIp) && requestedDate.empty)), langStr);
......
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