You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/21 16:34:47 UTC

[GitHub] [arrow] jonkeane commented on a change in pull request #12622: ARROW-15802 [R] bindings for `lubridate::make_datetime()` and `lubridate::make_date()`

jonkeane commented on a change in pull request #12622:
URL: https://github.com/apache/arrow/pull/12622#discussion_r831303350



##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -187,6 +187,51 @@ register_bindings_datetime <- function() {
   register_binding("date", function(x) {
     build_expr("cast", x, options = list(to_type = date32()))
   })
+  register_binding("make_datetime", function(year = 1970L,
+                                             month = 1L,
+                                             day = 1L,
+                                             hour = 0L,
+                                             min = 0L,
+                                             sec = 0,
+                                             tz = "UTC") {
+
+    # ParseTimestampStrptime currently ignores the timezone information (ARROW-12820).
+    # Stop if tz other than 'UTC' is provided.
+    if (tz != "UTC") {
+      arrow_not_supported("Time zone other than 'UTC'")
+    }
+
+    x <- call_binding("str_c", year, month, day, hour, min, sec, sep = "-")
+    build_expr("strptime", x, options = list(format = "%Y-%m-%d-%H-%M-%S", unit = 0L))
+  })
+  register_binding("make_date", function(year = 1970L, month = 1L, day = 1L) {
+    x <- call_binding("make_datetime", year, month, day)
+    build_expr("cast", x, options = cast_options(to_type = date32()))
+  })
+  register_binding("ISOdatetime", function(year,
+                                           month,
+                                           day, hour,

Review comment:
       ```suggestion
                                              day, 
                                              hour,
   ```
   
   Tiny nit: for alignment?




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org