R/adhanMonth.R

Defines functions adhanMonth

Documented in adhanMonth

adhanMonth<- function(
  method,
  city,
  country,
  month,
  year){
  
  if(is.numeric(method))
    method<-as.character(method)
  
  if(missing(month)|missing(year)){
    now<- unlist(strsplit(date(), split=" "))
    now<- now[which(now!="")]
    names(now)<- c("weekday", "month", "day", "time", "year")
    
  
  
  month<- match(now["month"], month.name)
  day<- now["day"]
  year<- now["year"]
  }
  callStr<-"http://api.aladhan.com/v1/calendar?latitude=51.508515&longitude=-0.1254872&method=2&month=4&year=2017"
  
  callStr<-paste("http://api.aladhan.com/v1/calendarByCity/",
                 year, "/",
                 month, "?",
                 "city=", city, "&",
                 "country=", country, "&",
                 "method=", method, sep="")
  
  call<- jsonlite::fromJSON(gsub(" ", "", callStr))

  
  res<- data.frame("date"=call$data$date$gregorian$date, 
          call$data$timings)
  return(res)
}
gacatag/adhan documentation built on April 6, 2024, 4:11 a.m.