From d3478f7e1c3901f1185efa4dc4e5f0e1758f869e Mon Sep 17 00:00:00 2001 From: Andrey Subbotin Date: Mon, 1 Oct 2018 12:56:39 +0400 Subject: [PATCH] LocalDate / LocalDateTime / LocalTime / OffsetTime / OffsetDateTime support for persistence and UI components #417 java.sql.Date conversation to ZonedDateTime --- .../haulmont/cuba/core/global/DateTimeTransformations.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/global/src/com/haulmont/cuba/core/global/DateTimeTransformations.java b/modules/global/src/com/haulmont/cuba/core/global/DateTimeTransformations.java index 32fa88d590..4638285261 100644 --- a/modules/global/src/com/haulmont/cuba/core/global/DateTimeTransformations.java +++ b/modules/global/src/com/haulmont/cuba/core/global/DateTimeTransformations.java @@ -36,7 +36,9 @@ public class DateTimeTransformations { public ZonedDateTime transformToZDT(Object date) { Preconditions.checkNotNull(date); ZoneId zoneId = ZoneId.systemDefault(); - if (date instanceof Date) { + if (date instanceof java.sql.Date) { + ((java.sql.Date) date).toLocalDate().atStartOfDay(zoneId); + } else if (date instanceof Date) { return ((Date) date).toInstant().atZone(zoneId); } else if (date instanceof LocalDate) { return ((LocalDate) date).atStartOfDay(zoneId);