xiazcy commented on code in PR #3090:
URL: https://github.com/apache/tinkerpop/pull/3090#discussion_r2032180452


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/DateDiffStep.java:
##########
@@ -53,17 +54,17 @@ public DateDiffStep(final Traversal.Admin traversal, final 
Traversal<?, Date> da
     protected Long map(final Traverser.Admin<S> traverser) {
         final Object object = traverser.get();
 
-        if (!(object instanceof Date))
+        if (!(object instanceof OffsetDateTime))
             throw new IllegalArgumentException(
-                    String.format("DateDiff can only take Date as argument, 
encountered %s", object.getClass()));
+                    String.format("DateDiff can only take DateTime as 
argument, encountered %s", object.getClass()));
 
-        final Date otherDate = value != null ? value :
+        final OffsetDateTime otherDate = value != null ? value :
                 dateTraversal != null ? TraversalUtil.apply(traverser, 
dateTraversal) : null;
 
         // let's not throw exception and assume null date == 0
-        final long otherDateMs = otherDate == null ? 0 : otherDate.getTime();
+        final long otherDateMs = otherDate == null ? 0 : 
otherDate.toEpochSecond();
 
-        return (((Date) object).getTime() - otherDateMs) / 1000;
+        return (((OffsetDateTime) object).toEpochSecond() - otherDateMs);

Review Comment:
   I like the simplification, not quite the right logic but I can use it, i.e. 
if `otherDate` is null we consider it as 0L and return the epoch seconds of 
`date`, instead of returning `0L`. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to