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
- Host: GitHub
- URL: https://github.com/mort3za/perscal
- Owner: mort3za
- License: mit
- Created: 2023-03-18T14:42:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-18T18:25:18.000Z (over 2 years ago)
- Last Synced: 2025-01-24T11:44:26.851Z (9 months ago)
- Topics: calendar, cli, date, persian-calendar, persian-date, terminal-based
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 dayExample:
`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 dayExample:
`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.