Skip to content

Commit

Permalink
Merge pull request #70 from MRPHarris/bugfix
Browse files Browse the repository at this point in the history
locale fix for issue #57
  • Loading branch information
rich-iannone authored Oct 28, 2021
2 parents dda821b + 12055b5 commit 4485112
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions R/get_met_gdas1.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,21 @@ get_met_gdas1 <- function(days,
seq(min_date, max_date, by = "1 day") %>%
lubridate::day()

month_names <-
seq(min_date, max_date, by = "1 day") %>%
lubridate::month(label = TRUE, abbr = TRUE, locale = "en_US.UTF-8") %>%
as.character() %>%
tolower()
# "en_US.UTF-8" is not a valid locale for windows.
os_for_locale <- get_os()
if(os_for_locale == "win"){
month_names <-
seq(min_date, max_date, by = "1 day") %>%
lubridate::month(label = TRUE, abbr = TRUE, locale = Sys.setlocale("LC_TIME", "English")) %>%
as.character() %>%
tolower()
} else {
month_names <-
seq(min_date, max_date, by = "1 day") %>%
lubridate::month(label = TRUE, abbr = TRUE, locale = "en_US.UTF-8") %>%
as.character() %>%
tolower()
}

met_years <-
seq(min_date, max_date, by = "1 day") %>%
Expand Down

0 comments on commit 4485112

Please sign in to comment.