From efb82985f76083a8bd21c84aca814b88640d52ee Mon Sep 17 00:00:00 2001 From: Jennifer Thom Date: Fri, 13 Dec 2024 09:16:01 +0000 Subject: [PATCH] Automate `get_dd_period` --- R/00-update_refs.R | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/R/00-update_refs.R b/R/00-update_refs.R index 311bfc21b..ffdbcf912 100644 --- a/R/00-update_refs.R +++ b/R/00-update_refs.R @@ -102,7 +102,13 @@ check_year_valid <- function( #' #' @family initialisation get_dd_period <- function() { - "Jul16_Sep24" + + first_part <- substr(previous_update(), 1, 3) + end_part <- substr(previous_update(), 7, 8) + + dd_period <- as.character(stringr::str_glue('Jul16_{first_part}{end_part}')) + + return(dd_period) }