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/04/14 12:09:07 UTC

[GitHub] [arrow] thisisnic commented on a diff in pull request #12589: ARROW-14848 [R] Implement bindings for lubridate's parse_date_time, parse_date_time2, and fast_strptime

thisisnic commented on code in PR #12589:
URL: https://github.com/apache/arrow/pull/12589#discussion_r850378278


##########
r/R/dplyr-funcs-datetime.R:
##########
@@ -372,3 +428,27 @@ binding_format_datetime <- function(x, format = "", tz = "", usetz = FALSE) {
 
   build_expr("strftime", x, options = list(format = format, locale = Sys.getlocale("LC_TIME")))
 }
+
+build_formats <- function(orders) {
+  year_chars <- sprintf("%%%s", c("y", "Y"))
+  month_chars <- sprintf("%%%s", c("m", "B", "b"))
+  day_chars <- sprintf("%%%s", c("d"))
+
+  outcome <- switch(
+    orders,
+    "ymd" = expand.grid(year_chars, month_chars, day_chars),
+    "ydm" = expand.grid(year_chars, day_chars, month_chars),
+    "mdy" = expand.grid(month_chars, day_chars, year_chars),
+    "myd" = expand.grid(month_chars, year_chars, day_chars),
+    "dmy" = expand.grid(day_chars, month_chars, year_chars),
+    "dym" = expand.grid(day_chars, year_chars, month_chars)
+  )
+  outcome$format <- paste(outcome$Var1, outcome$Var2, outcome$Var3, sep = "-")
+  outcome$format
+}
+
+instert_at_position <- function(string, positions, replacement) {

Review Comment:
   ```suggestion
   instert_at_position <- function(string, positions, replacement) {
   ```
   I think "instert" is a typo



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