Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/movahhedi/persian-leap
https://github.com/movahhedi/persian-leap
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/movahhedi/persian-leap
- Owner: movahhedi
- License: mit
- Created: 2024-08-21T08:11:10.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-09T08:32:35.000Z (4 months ago)
- Last Synced: 2024-09-09T10:08:30.050Z (4 months ago)
- Language: TypeScript
- Size: 75.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Persian Leap Year
A simple library to check if a Persian year is a leap year or not.
Based on [this Wikipedia page](https://fa.wikipedia.org/wiki/%DA%AF%D8%A7%D9%87%E2%80%8C%D8%B4%D9%85%D8%A7%D8%B1%DB%8C_%D8%B1%D8%B3%D9%85%DB%8C_%D8%A7%DB%8C%D8%B1%D8%A7%D9%86) which references [the official Iranian calendar](https://calendar.ut.ac.ir).
## Installation
Install it via [npm](https://www.npmjs.com/package/persian-leap):
```bash
npm install persian-leap
```
Or yarn:
```bash
yarn add persian-leap
```
Or pnpm:
```bash
pnpm add persian-leap
```## Usage
To check if a Persian year is a leap year or not, use the `isPersianLeapYear()` function.
```javascript
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.
```javascript
import { getDaysInPersianMonth } from "persian-leap";console.log(getDaysInPersianMonth(1403, 12)); // 30
console.log(getDaysInPersianMonth(1404, 12)); // 29
```