From 51bef32091777580389ef03051ac32f2a10b5fd1 Mon Sep 17 00:00:00 2001 From: laresbernardo Date: Wed, 14 Sep 2022 17:30:58 -0700 Subject: [PATCH] Force date input to be character When passing a date in `Date` class, some functions crashed with the following error: ``` Error in if (date != "" && period != "") { : missing value where TRUE/FALSE needed ``` --- R/common.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/common.R b/R/common.R index 1f5f3c9..ea53dc9 100755 --- a/R/common.R +++ b/R/common.R @@ -71,10 +71,10 @@ extract_content <- function(response) } format_date <- function(date){ - if(lubridate::is.Date(date)){ - format(date, "%Y-%m-%d") - }else{ - date + if (lubridate::is.Date(date)){ + as.character(format(date, "%Y-%m-%d")) + } else{ + as.character(date) } }