Skip to content

Commit b8becdd

Browse files
v1.1
1 parent daec6ce commit b8becdd

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

R/calendR.R

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,6 @@ calendR <- function(year = format(Sys.Date(), "%Y"),
380380
} else {
381381

382382
if(is.character(special.days)) {
383-
384-
385383
if (length(special.days) == length(dates)) {
386384
fills <- special.days
387385
} else {
@@ -406,10 +404,18 @@ calendR <- function(year = format(Sys.Date(), "%Y"),
406404

407405
if(missing(title)) {
408406

409-
if(is.null(month)) {
410-
title <- year
411-
} else {
412-
title <- levels(t2$monlabel)
407+
if(!is.null(start_date) & !is.null(end_date)) {
408+
409+
title <- paste0(format(as.Date(start_date), "%m"), "/", format(as.Date(start_date), "%Y"), " - ",
410+
format(as.Date(end_date), "%m"), "/", format(as.Date(end_date), "%Y"))
411+
412+
}else{
413+
414+
if(is.null(month)) {
415+
title <- year
416+
} else {
417+
title <- levels(t2$monlabel)
418+
}
413419
}
414420
}
415421

0 commit comments

Comments
 (0)