R/hijday.R

Defines functions hijday

Documented in hijday

#' Get day of the week in Arabic
#'
#' @param x a date as a string in dd-mm-yyyy format
#'
#' @return Day of the week in Arabic
#' @export
#'
#' @examples
#' x <- "12-12-2021"
#' hijday(x)
hijday <- function(x){
  query = list(date = x)
  retrieved_data <- httr::GET("http://api.aladhan.com/v1/gToH", query = query)
  Sys.sleep(stats::runif(1, 0, 1))
  cont <- httr::content(retrieved_data, as = "text")
  date1 <- jsonlite::fromJSON(cont)
  date1$data$hijri$weekday$en
}
Luka-Vasilj/hijRead documentation built on Jan. 1, 2022, 12:53 p.m.