dragosmg commented on code in PR #12589:
URL: https://github.com/apache/arrow/pull/12589#discussion_r850441613
##########
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:
Good catch! That was actually not used anywhere (leftover from a previous
attempt). Removed it
--
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]