Jalali, also known as Persian, Solar Hijri and Hijri Shamsi calendar is the official calendar of Iran and Afghanistan. It begins on Nowruz, the March equinox, as determined by astronomical calculation and has years of 365 or 366 days. Adapting the algorithms in https://jdf.scr.ir/, this package provides tools for converting the Jalali and Gregorian dates.
To install the package from CRAN, run the following in R:
install.packages('jalcal')
You can also install the current version of the package on GitHub by running:
require(remotes)
install_github('jalilian/jalcal')
If remotes is not installed, you should first run:
install.packages('remotes')
As examples of converting Jalali dates to Gregorian dates, simply run
require('jalcal')
jal2greg(1, 1, 1)
jal2greg(1362, 6, 17)
jal2greg(1362, 6, 17, asDate=FALSE)
jal2greg(c(1362, 1394), c(6, 3), c(17, 19))
jal2greg(c(1362, 1394), c(6, 3), c(17, 19), asDate=FALSE)
Run the following as examples of converting Gregorian dates to Jalali dates
greg2jal0(622, 3, 21)
greg2jal0(1983, 9, 8)
greg2jal0(c(1983, 2015), c(9, 6), c(8, 9))
greg2jal0(c(1983, 2015), c(9, 6), c(8, 9), asDate=TRUE)
greg2jal(base::Sys.Date())