Skip to content

srishanbhattarai/nepcal

Repository files navigation

nepcal · Build Status Build status Coverage Status Go Report Card GoDoc

Nepcal is a command line tool and a library that provides several functionalities pertaining to Bikram Sambat (B.S.) calendars, the official calendar in Nepal.

Table of Contents

Command Line

The nepcal CLI was initially inspired from the cal command on Linux, but expanded to have much more functionality, namely:

  • Show the current Nepali month's calendar (Similar to cal)
  • Show today's Nepali date and day
  • Convert A.D. (gregorian) dates to B.S. dates and vice-versa.

Installation

There are several ways to install the CLI. Pick the one that best suits you from the options below. In any case, run nepcal on your terminal; if you see some formatted output then you are good to go.

Pre-built binaries

Pre-built tarball executables/binaries are available in the Releases page for MacOS, Windows, and Linux. Download and untar the binary for your platform, then move it into your executable path. e.g. /usr/local/bin on Mac or Linux.

You might need to give the script execution permissions. On Linux and MacOS this would mean using chmod as follows:

$ chmod +x /usr/local/bin/nepcal

Homebrew on Mac

Tap the repository first.

$ brew tap srishanbhattarai/nepcal https://github.com/srishanbhattarai/nepcal

Then, run:

$ brew install nepcal

Using go get

You can also install nepcal manually if you have the Go toolchain installed.

$ go get -v github.com/srishanbhattarai/nepcal/cmd/nepcal

Usage

Complete details can be found by running nepcal help.

Monthly Calendar

$ nepcal # or nepcal cal
    चैत ११, २०७६
 Su Mo Tu We Th Fr Sa
                   १
 २  ३  ४  ५  ६  ७  ८
 ९  १० ११ १२ १३ १४ १५
 १६ १७ १८ १९ २० २१ २२
 २३ २४ २५ २६ २७ २८ २९
 ३०

Today's Date

$ nepcal date # or nepcal d

चैत १०, २०७६ सोमबार

Convert A.D. to B.S.

Use the mm-dd-yyyy format when converting A.D. to B.S.

$ nepcal conv tobs 08-21-1994

भदौ ५, २०५१ आइतबार

Convert B.S. to A.D.

Use the mm-dd-yyyy format when converting B.S. to A.D.

$ nepcal conv toad 08-18-2053

December 3, 1996 Tuesday

Library

If you would like to use nepcal as a Go library, the best reference is the Godoc documentation for this package which should be fairly easy to navigate. The CLI tool is also built on this library. However, there are additional functionalities provided in the library that are not relevant in the CLI, for example the NumDaysSpanned() method.

Acknowledgements

nepcal uses nepcal.com as the source of information used to create this tool. Among several sources, they were deemed most reliable.

The name nepcal was independently chosen for this project which happened to coincide with the website.

Contributing

Please file an issue if you have any problems with nepcal or, have a look at the issues page for contributing on existing issues. Also, read the code of conduct.

License

MIT