diff --git a/src/main/java/fr/inra/oresing/domain/data/read/query/IntervalValuesDate.java b/src/main/java/fr/inra/oresing/domain/data/read/query/IntervalValuesDate.java index e59b403ed00d8cbdf43f05446b669442e54cef2a..85d028768660e8a8f94d67c455d039cf93f771ec 100644 --- a/src/main/java/fr/inra/oresing/domain/data/read/query/IntervalValuesDate.java +++ b/src/main/java/fr/inra/oresing/domain/data/read/query/IntervalValuesDate.java @@ -3,7 +3,9 @@ package fr.inra.oresing.domain.data.read.query; import com.google.common.base.Strings; import fr.inra.oresing.domain.exceptions.data.data.BadDownloadDatasetQuery; +import java.time.Instant; import java.time.LocalDate; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.util.Map; @@ -24,14 +26,26 @@ public record IntervalValuesDate( } if (from != null) { try { - fromDate = LocalDate.from(DateTimeFormatter.ofPattern(format).parse(from)); + if (from.matches("[0-9]*")) { + ZoneId zone = ZoneId.of("UTC"); + fromDate = LocalDate.ofInstant(Instant.ofEpochMilli(Long.valueOf(from)), zone); + from = fromDate.format(DateTimeFormatter.ofPattern(format)); + } else { + fromDate = LocalDate.from(DateTimeFormatter.ofPattern(format).parse(from)); + } } catch (final DateTimeParseException e) { throw new BadDownloadDatasetQuery(FILTER_BAD_FORMAT_FOR_START_DATE); } } if (to != null) { try { - toDate = LocalDate.from(DateTimeFormatter.ofPattern(format).parse(to)); + if (to.matches("[0-9]*")) { + ZoneId zone = ZoneId.of("UTC"); + toDate = LocalDate.ofInstant(Instant.ofEpochMilli(Long.valueOf(to)), zone); + to = toDate.format(DateTimeFormatter.ofPattern(format)); + } else { + toDate = LocalDate.from(DateTimeFormatter.ofPattern(format).parse(to)); + } } catch (final DateTimeParseException e) { throw new BadDownloadDatasetQuery(FILTER_BAD_FORMAT_FOR_END_DATE); } diff --git a/ui/src/components/common/InputDateInterval.vue b/ui/src/components/common/InputDateInterval.vue index 6c138fbd93b78cc23430346def97308f6ecc6c4d..887bdfe1a4697a22b2651fa958a059da55799c58 100644 --- a/ui/src/components/common/InputDateInterval.vue +++ b/ui/src/components/common/InputDateInterval.vue @@ -34,7 +34,7 @@ export default { } if (fromValueDate.value < toValueDate.value) { ctx.emit("update:dateValueInterval", { - interval: { from: fromValueDate.value, to: toValueDate.value }, + interval: { from: new Date(fromValueDate.value).getTime(), to: new Date(toValueDate.value).getTime() }, }); } } diff --git a/ui/src/components/common/InputNumber.vue b/ui/src/components/common/InputNumber.vue index 3a8382937aeba925d18063a8cc3ad2b3a52359d1..643af721612ed66ce2356de42bda750b3257c0ca 100644 --- a/ui/src/components/common/InputNumber.vue +++ b/ui/src/components/common/InputNumber.vue @@ -45,7 +45,7 @@ export default { :placeholder="format" controls-position="compact" controls-rounded - :step="format === 'float' ? 0.1 : 1" + :step="format === 'float' ? 0.001 : 1" type="is-light" @blur="updateValueNumber" >