From 4c1166418ee82609772e6204556e00f4ad219c2c Mon Sep 17 00:00:00 2001 From: matthiasgeiger Date: Mon, 19 Dec 2016 20:06:00 +0100 Subject: [PATCH] use localdatetime instead of zonedDateTime --- src/main/java/net/sf/jabref/gui/date/DatePickerButton.java | 3 +-- .../java/net/sf/jabref/logic/util/date/EasyDateFormat.java | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/sf/jabref/gui/date/DatePickerButton.java b/src/main/java/net/sf/jabref/gui/date/DatePickerButton.java index 6b4a3b997fa..dd7b0058c10 100644 --- a/src/main/java/net/sf/jabref/gui/date/DatePickerButton.java +++ b/src/main/java/net/sf/jabref/gui/date/DatePickerButton.java @@ -2,7 +2,6 @@ import java.awt.BorderLayout; import java.time.LocalDate; -import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import javax.swing.JComponent; @@ -54,7 +53,7 @@ public void dateChanged(DateChangeEvent dateChangeEvent) { if (isoFormat) { editor.setText(date.format(DateTimeFormatter.ISO_DATE)); } else { - EasyDateFormat.fromTimeStampFormat(Globals.prefs.get(JabRefPreferences.TIME_STAMP_FORMAT)).getDateAt(ZonedDateTime.from(date)); + EasyDateFormat.fromTimeStampFormat(Globals.prefs.get(JabRefPreferences.TIME_STAMP_FORMAT)).getDateAt(date.atStartOfDay()); } } else { // in this case the user selected "none" in the date picker, so we just clear the field diff --git a/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java b/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java index 25885be93f6..cfe6b0658f1 100644 --- a/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java +++ b/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java @@ -1,6 +1,6 @@ package net.sf.jabref.logic.util.date; -import java.time.ZonedDateTime; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class EasyDateFormat { @@ -27,7 +27,7 @@ public EasyDateFormat(DateTimeFormatter dateFormatter) { * @return The date string. */ public String getCurrentDate() { - return getDateAt(ZonedDateTime.now()); + return getDateAt(LocalDateTime.now()); } /** @@ -36,7 +36,7 @@ public String getCurrentDate() { * * @return The formatted date string. */ - public String getDateAt(ZonedDateTime dateTime) { + public String getDateAt(LocalDateTime dateTime) { // first use, create an instance return dateTime.format(dateFormatter); }