Cole-Greer commented on code in PR #3090:
URL: https://github.com/apache/tinkerpop/pull/3090#discussion_r2029360410
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/DateAddStep.java:
##########
@@ -57,16 +46,32 @@ public DateAddStep(final Traversal.Admin traversal, final
DT dateToken, final in
}
@Override
- protected Date map(final Traverser.Admin<S> traverser) {
+ protected OffsetDateTime map(final Traverser.Admin<S> traverser) {
final Object object = traverser.get();
- if (!(object instanceof Date)) throw new
IllegalArgumentException("dateAdd accept only Date.");
-
- final Calendar cal = Calendar.getInstance();
- cal.setTime((Date) object);
- cal.add(DTtoCalendar.get(dateToken), value);
-
- return cal.getTime();
+ if (!(object instanceof OffsetDateTime)) throw new
IllegalArgumentException("dateAdd accept only DateTime.");
+
+ OffsetDateTime date = (OffsetDateTime) object;
+ OffsetDateTime new_date;
+
+ switch (dateToken) {
Review Comment:
nit: `dateToken` and `value` should arguably be converted to a `Duration` in
the constructor for this step so this conversion does not need to happen each
time the step is iterated.
--
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]