Giter Site home page Giter Site logo

perscal's Introduction

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 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 <options>

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 <seconds>: Unix timestamp (seconds since 1970-01-01 00:00:00 UTC)
  • -dt, --date <date-string>: "Gregorian date (YYYY-MM-DD) or other standard formats e.g. ISO 8601")
  • -y, --year <year>: Gregorian year
  • -m, --month <month>: Gregorian month
  • -d, --day <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>: Persian date (YYYY-MM-DD)
  • -py, --persian-year <persian-year>: Persian year
  • -pm, --persian-month <persian-month>: Persian month
  • -pdy, --persian-day <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 <char> 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 file for details.

perscal's People

Contributors

mort3za avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.