make it possible to specify the time in the range
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
package org.lucares.pdb.plot.api;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.OffsetTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class PlotSettings {
|
||||
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private String query;
|
||||
|
||||
private int height;
|
||||
@@ -95,7 +98,7 @@ public class PlotSettings {
|
||||
|
||||
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(Long.MIN_VALUE), ZoneOffset.UTC);
|
||||
} else {
|
||||
return LocalDate.parse(dateFrom).atTime(OffsetTime.of(0, 0, 0, 0, ZoneOffset.UTC));
|
||||
return LocalDateTime.parse(dateFrom, DATE_FORMAT).atOffset(ZoneOffset.UTC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +106,7 @@ public class PlotSettings {
|
||||
if (StringUtils.isEmpty(dateTo)) {
|
||||
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(Long.MAX_VALUE), ZoneOffset.UTC);
|
||||
} else {
|
||||
return LocalDate.parse(dateTo).atTime(OffsetTime.of(23, 59, 59, 999_999_999, ZoneOffset.UTC));
|
||||
return LocalDateTime.parse(dateTo, DATE_FORMAT).atOffset(ZoneOffset.UTC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user