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


##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/translator/GoTranslateVisitor.java:
##########
@@ -57,8 +57,16 @@ public GoTranslateVisitor(final String 
graphTraversalSourceName) {
     public Void visitDateLiteral(final GremlinParser.DateLiteralContext ctx) {
         // child at 2 is the date argument to datetime() and comes enclosed in 
quotes
         final String dtString = ctx.getChild(2).getText();
-        final Date dt = 
DatetimeHelper.parse(removeFirstAndLastCharacters(dtString));
-        sb.append("time.UnixMilli(" + dt.getTime() + ")");
+        final OffsetDateTime dt = 
DatetimeHelper.parse(removeFirstAndLastCharacters(dtString));
+        sb.append("time.Date(").append(dt.getYear()).
+                append(", ").append(dt.getMonthValue()).
+                append(", ").append(dt.getDayOfMonth()).
+                append(", ").append(dt.getHour()).
+                append(", ").append(dt.getMinute()).
+                append(", ").append(dt.getSecond()).
+                append(", ").append(dt.getNano()).
+                append(", time.FixedZone(\"UTC\", 
").append(dt.getOffset().getTotalSeconds()).append(")").

Review Comment:
   I can add the tests. 
   
   Technically the fixed zone name in go for this is a string only for display 
purposes...I.e. you can pass in any random string and it just appears at the 
end of your time display (doesn't affect the date calculation at all). For 
simplicity I just left the "UTC" string in, but can get the zoneId from 
OffsetDateTime instead. 



-- 
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