Skip to content

Commit

Permalink
Merge pull request #21 from TanguyBarthelemy/develop
Browse files Browse the repository at this point in the history
accept other classes for date format
  • Loading branch information
clemasso authored Apr 12, 2024
2 parents 000ce26 + f4f78a3 commit a3ba152
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/vintages.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ convert_time_period <- function(x, date_format = "%Y-%m-%d") {
convert_rev_date <- function(x, date_format = "%Y-%m-%d") {

checkmate::assert_atomic(unique(x), min.len = 2)
checkmate::assert_choice(class(x), choices = c("character", "integer", "Date"))
if (!inherits(x = x, what = c("character", "integer", "Date", "POSIXt"))) {
stop("The revdate column must be of type character, integer, Date or POSIXt.")
}
if (any(is.na(as.Date(x, format = date_format)))) {
stop("Revisions date not in a correct format. You can specify the format of your date with the argument `format_date`")
}
Expand Down

0 comments on commit a3ba152

Please sign in to comment.