Open ailich opened 2 years ago
Thanks for the report. This looks like a problem that would only occur on Windows.
We need to think more about the mapping language to locale in a platform-independent way.
Can you please tweak the generated cd_format_date()
function to use a supported locale, e.g. "English_United States.1252"
?
I think cd_format_date()
should not rely on the system, but instead do something as discussed in https://github.com/cynkra/indiedown/issues/12.
@krlmlr changing "en_US"
to "English_United States.1252"
removed the warning for me on Windows.
cd_format_date <- function(date, lang = default(rmarkdown::metadata$lang, "en-US")) {
date <- as.Date(date)
if (lang %in% c("german", "de-DE", "de-CH")) {
withr::with_locale(c("LC_TIME" = "de_DE"), format(date, "%e. %B %Y"))
} else {
withr::with_locale(c("LC_TIME" = "English_United States.1252"), format(date, "%B %e, %Y"))
}
}
When I create the
mydown
package as in the example, and then use the template without any editing, I'm getting an R code warning printed at the top