diff --git a/build.gradle b/build.gradle index 7f2cf13cf24c..b4320458e1cb 100644 --- a/build.gradle +++ b/build.gradle @@ -121,9 +121,6 @@ dependencies { compile 'org.xmlunit:xmlunit-core:2.3.0' compile 'org.xmlunit:xmlunit-matchers:2.3.0' - - compile 'com.github.lgooddatepicker:LGoodDatePicker:8.3.0' - testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:2.3.0' testCompile 'com.github.tomakehurst:wiremock:2.4.1' diff --git a/external-libraries.txt b/external-libraries.txt index 3ae69fbb2f09..8f927b96131f 100644 --- a/external-libraries.txt +++ b/external-libraries.txt @@ -137,10 +137,11 @@ Project: SwingX URL: https://swingx.java.net/ License: LGPL-3.0 -Id: com.github.lgooddatepicker:LGoodDatePicker -Project: LGoodDatePicker -URL: https://github.com/LGoodDatePicker/LGoodDatePicker -License: MIT +Id: microba +Path: lib/microba.jar +Project: Microba +URL: https://github.com/tdbear/microba +License: BSD Id: spin Path: lib/spin.jar diff --git a/lib/microba.jar b/lib/microba.jar new file mode 100644 index 000000000000..8367e76214a1 Binary files /dev/null and b/lib/microba.jar differ diff --git a/src/main/java/net/sf/jabref/gui/IconTheme.java b/src/main/java/net/sf/jabref/gui/IconTheme.java index b2e1aa9aa1f6..91eb697ad9cb 100644 --- a/src/main/java/net/sf/jabref/gui/IconTheme.java +++ b/src/main/java/net/sf/jabref/gui/IconTheme.java @@ -158,7 +158,6 @@ public enum JabRefIcon { FACEBOOK("\uf20c"), /* css: facebook */ BLOG("\uf46b"), /* css: rss */ GLOBAL_SEARCH("\uF1E7"), /* css: earth */ - DATE_PICKER("\uF0ED;"), /* css: calendar */ // STILL MISSING: GROUP_REGULAR("\uF4E6", Color.RED); 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 new file mode 100644 index 000000000000..3eb5a03dd608 --- /dev/null +++ b/src/main/java/net/sf/jabref/logic/util/date/EasyDateFormat.java @@ -0,0 +1,63 @@ +package net.sf.jabref.logic.util.date; + +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Date; + +public class EasyDateFormat { + + /** + * The formatter objects + */ + private final DateTimeFormatter dateFormatter; + + + public EasyDateFormat(String dateFormat) { + this(DateTimeFormatter.ofPattern(dateFormat)); + } + + public EasyDateFormat(DateTimeFormatter dateFormatter) { + this.dateFormatter = dateFormatter; + } + + /** + * Creates a String containing the current date (and possibly time), + * formatted according to the format set in preferences under the key + * "timeStampFormat". + * + * @return The date string. + */ + public String getCurrentDate() { + return getDateAt(ZonedDateTime.now()); + } + + /** + * Creates a readable Date string from the parameter date. The format is set + * in preferences under the key "timeStampFormat". + * + * @return The formatted date string. + */ + public String getDateAt(Date date) { + return getDateAt(date.toInstant().atZone(ZoneId.systemDefault())); + } + + /** + * Creates a readable Date string from the parameter date. The format is set + * in preferences under the key "timeStampFormat". + * + * @return The formatted date string. + */ + public String getDateAt(ZonedDateTime dateTime) { + // first use, create an instance + return dateTime.format(dateFormatter); + } + + public static EasyDateFormat fromTimeStampFormat(String timeStampFormat) { + return new EasyDateFormat(timeStampFormat); + } + + public static EasyDateFormat isoDateFormat() { + return new EasyDateFormat(DateTimeFormatter.ISO_LOCAL_DATE); + } +}