#' Read Opening Hours
#'
#' @param x A non-missing character vector of opening hours.
#'
#' @return A tibble of the Open and Close times by vector element.
#' @export
#'
#' @examples
#' read_opening_hours(character(0))
#' read_opening_hours("9:00-17:00")
read_opening_hours <- function(x) {
chk_character(x)
chk_not_any_na(x)
if (!length(x)) {
return(empty_read())
}
if (!vld_named(x)) {
names(x) <- 1:length(x)
}
chk_unique(names(x))
x <- tibble::tibble(Name = names(x), String = unname(x))
x$OpeningHours <- lapply(x$String, parse)
tibble::as_tibble(x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.