persian-leap
v0.3.0
Published
Check if a year is a leap year in the Persian calendar.
Downloads
17
Maintainers
Readme
Persian Leap Year
A simple library to check if a Persian year is a leap year or not.
Based on this Wikipedia page which references the official Iranian calendar.
Installation
Install it via npm:
npm install persian-leap
Or yarn:
yarn add persian-leap
Or pnpm:
pnpm add persian-leap
Usage
To check if a Persian year is a leap year or not, use the isPersianLeapYear()
function.
import { isPersianLeapYear } from "persian-leap";
console.log(isPersianLeapYear(1403)); // true
console.log(isPersianLeapYear(1404)); // false
To get the number of days in a Persian month, use the getDaysInPersianMonth()
function.
import { getDaysInPersianMonth } from "persian-leap";
console.log(getDaysInPersianMonth(1403, 12)); // 30
console.log(getDaysInPersianMonth(1404, 12)); // 29