An open API service indexing awesome lists of open source software.

https://github.com/mort3za/perscal

Persian-Gregorian Date Converter for CLI
https://github.com/mort3za/perscal

calendar cli date persian-calendar persian-date terminal-based

Last synced: 7 months ago
JSON representation

Persian-Gregorian Date Converter for CLI

Awesome Lists containing this project

README

          

# PersCal - Persian-Gregorian Date Converter for CLI

This is a command-line interface (CLI) tool for converting between Gregorian and Persian calendars. The tool is built with Node.js and utilizes the [jalaali-js](https://github.com/jalaali/jalaali-js) package for the calendar conversion.

## Installation

To install the tool, first, you need to have Node.js installed on your machine. Then you can install the package via npm:

`npm install -g perscal`

Or without installation:
`npx perscal `

## Usage

You can use the `--help` option to see the available options:

`perscal --help`

### Converting Gregorian to Persian

You can convert a Gregorian date to Persian using the following options:

- `-t, --timestamp `: Unix timestamp (seconds since 1970-01-01 00:00:00 UTC)
- `-dt, --date `: "Gregorian date (YYYY-MM-DD) or other standard formats e.g. ISO 8601")
- `-y, --year `: Gregorian year
- `-m, --month `: Gregorian month
- `-d, --day `: Gregorian day

Example:

`perscal` // output: 1401-12-27
`perscal --date 2023-03-18` // 1401-12-27
`perscal --year 2023 --month 3 --day 18` // output: 1401-12-27

### Converting Persian to Gregorian

You can convert a Persian date to Gregorian using the following options:

- `-pd, --persian-date `: Persian date (YYYY-MM-DD)
- `-py, --persian-year `: Persian year
- `-pm, --persian-month `: Persian month
- `-pdy, --persian-day `: Persian day

Example:

`perscal --persian-date 1401-12-27` // output: 2023-3-18
`perscal --persian-year 1401 --persian-month 12 --persian-day 27` // output: 2023-3-18

### Output Separator for Persian Date

To specify the separator character, use `-s, --separator ` option for the output. The default separator is `-`.

Example:

`perscal --year 2022 --month 3 --day 18 --separator /`

## License

This tool is licensed under the MIT license. See the [LICENSE](LICENSE) file for details.