diff --git a/rulette-core/pom.xml b/rulette-core/pom.xml
index d4d2186..b527d1a 100644
--- a/rulette-core/pom.xml
+++ b/rulette-core/pom.xml
@@ -12,11 +12,6 @@
Core classes for Rulette Framework
-
- joda-time
- joda-time
- 2.8.2
-
org.slf4j
slf4j-api
diff --git a/rulette-core/src/main/java/com/github/kislayverma/rulette/core/ruleinput/value/defaults/InputDateValue.java b/rulette-core/src/main/java/com/github/kislayverma/rulette/core/ruleinput/value/defaults/InputDateValue.java
index 9e7c0ec..334827b 100644
--- a/rulette-core/src/main/java/com/github/kislayverma/rulette/core/ruleinput/value/defaults/InputDateValue.java
+++ b/rulette-core/src/main/java/com/github/kislayverma/rulette/core/ruleinput/value/defaults/InputDateValue.java
@@ -4,21 +4,23 @@
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
+
+import java.time.format.DateTimeFormatter;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
class InputDateValue implements IInputValue, Serializable {
private static final long serialVersionUID = 5666450390675442878L;
private static final String DATE_PATTERN = "yyyy-MM-dd HH:mm:ss";
- private static final DateTimeFormatter formatter = DateTimeFormat.forPattern(DATE_PATTERN);
+ private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DATE_PATTERN);
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat(DATE_PATTERN);
private final Date value;
public InputDateValue (String value) {
- this.value = value == null || value.isEmpty() ? null : formatter.parseDateTime(value).toDate();
+ this.value = value == null || value.isEmpty() ? null : this.DatefromLocalDateTime(LocalDateTime.parse((CharSequence)value, formatter));
}
-
+
@Override
public boolean isEmpty() {
return value == null;
@@ -31,7 +33,7 @@ public Date getValue() {
@Override
public int compareTo(String obj) {
- return this.value.compareTo(formatter.parseDateTime(obj).toDate());
+ return this.value.compareTo(DatefromLocalDateTime(LocalDateTime.parse(obj, formatter)));
}
@Override
@@ -59,9 +61,14 @@ public boolean equals(Object obj) {
return that.getValue().equals(this.value);
}
}
-
+
@Override
public String toString() {
return this.value == null ? "" : SIMPLE_DATE_FORMAT.format(this.value);
}
+
+ private Date DatefromLocalDateTime(LocalDateTime ldt){
+ return Date.from(ldt.atZone(ZoneId.systemDefault()).toInstant());
+ }
+
}
diff --git a/rulette-core/src/main/java/com/github/kislayverma/rulette/core/util/RuletteInputProcessor.java b/rulette-core/src/main/java/com/github/kislayverma/rulette/core/util/RuletteInputProcessor.java
index db4cd02..a85dff8 100644
--- a/rulette-core/src/main/java/com/github/kislayverma/rulette/core/util/RuletteInputProcessor.java
+++ b/rulette-core/src/main/java/com/github/kislayverma/rulette/core/util/RuletteInputProcessor.java
@@ -1,12 +1,10 @@
package com.github.kislayverma.rulette.core.util;
import com.github.kislayverma.rulette.core.annotations.RuletteInput;
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
import java.lang.reflect.Field;
-
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -16,9 +14,10 @@
*/
public class RuletteInputProcessor {
- private static final DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
+ private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
public static Map generateInputMap(Object request) throws IllegalAccessException {
+
Map inputMap = new HashMap<>();
Field[] fieldsInObject = request.getClass().getDeclaredFields();
for(Field field : fieldsInObject){
@@ -34,7 +33,7 @@ public static Map generateInputMap(Object request) throws Illega
fieldValueString = "";
}else {
if(fieldValue instanceof Date){
- fieldValueString = new DateTime(fieldValue).toString(formatter);
+ fieldValueString = LocalDateTime.parse((CharSequence)fieldValue, formatter).format(formatter);
}else {
fieldValueString = fieldValue.toString();
}