nepdate-cli is a command-line tool for displaying and converting dates between the Bikram Sambat (Vikram Samvat) and Gregorian calendars. It's a simple utility designed for easy interaction with these two calendar systems.
Note
Rust port is available at rust branch of this repository. if you want to install just binary using cargo use
cargo install nepdate-cli
or use as dependency on Cargo.toml file. nepdate-cli = "0.1.3"
check https://github.com/opensource-nepal/nepdate-cli/blob/rust/src/bikram.rs for available functions or https://github.com/opensource-nepal/nepdate-cli/blob/rust/src/main.rs for example uses.
read readme file for rust https://github.com/opensource-nepal/nepdate-cli/blob/rust/README.md
- Display the current Bikram Sambat date.
- Convert dates between Bikram Sambat and Gregorian calendars.
- Supports date formatting with devnagari script and date format specifiers.
- Supports very long date range.
There are two installation methods available: using a Debian package or compiling from source.
-
Download the latest
.deb
file from the releases page. -
Install the package using
dpkg
:sudo dpkg -i nepdate-cli_1.0.0_amd64.deb
Replace
nepdate-cli_1.0.0_amd64.deb
with the filename of the downloaded package.
-
Clone the repository:
git clone https://github.com/opensource-nepal/nepdate-cli.git cd nepdate-cli
-
Install dependencies:
sudo apt-get update sudo apt-get install -y cmake build-essential debhelper devscripts
packages debhelper and devscripts are for building debian installer package.
-
Build and install:
mkdir build cd build cmake .. make sudo make install
if need to build deb package with signing, run
dpkg-buildpackage -b
from project root directory. (you have to edit email address to yours in files in /debian folder.)dpkg-buildpackage -b -us -uc
command builds debian package without signing.
Once installed, you can use nepdate-cli from the command line. Here are some basic commands:
nepdate-cli
Output:
Today's Date:
Gregorian: 2024 11 15 Friday
Bikram Sambat: 2081 8 30 शुक्रवार days in bikram month: 30
Usage:
Show today's date: ./ndate --today [--unicode] [--format format_string]
Convert to Bikram Sambat Date: ./ndate --tobs year month day [--unicode] [--format format_string]
Convert to Gregorian Date: ./ndate --toad year month day [--unicode] [--format format_string]
Options:
--unicode : Display the date in Unicode format (Devanagari script).
--format format_string : Specify a custom format for the date (e.g., 'y-m-d', 'd-M-y'). Default: 'y-m-d'
Format Specifiers:
y : Year
m : Month (numeric)
d : Day
w : Weekday name
M : Month name
Example commands:
./ndate --today --unicode --format 'd-M-y' : Show today's date in Unicode with custom format.
./ndate --tobs 2024 11 15 --unicode --format 'y-m-d' : Convert a Gregorian date to Bikram Sambat date.
./ndate --toad 2081 8 30 --unicode --format 'y/m/d' : Convert a Nepali date to Gregorian date.
-
Show today's date in Devanagari script with default format:
./ndate --today --unicode
Output: २०८१-८-३०
-
Convert a Gregorian date to Bikram Sambat date in Devanagari script:
./ndate --tobs 2024 11 15 --unicode
Output: २०८१-८-३०
-
Show today's date with custom format 'd-M-y':
./ndate --today --format 'd-M-y'
Output: ३०-श्रावण-२०८१
-
Convert a Bikram Sambat date to Gregorian date with weekday name:
./ndate --toad 2081 8 30 --format 'w, y-m-d' --unicode
Output: शुक्रवार, २०८१-८-३०
Contributions are welcome! If you have any bug reports or feature requests, please open an issue on the GitHub repository.
Here's a quick guide to contributing code:
- Fork the repository.
- Create a new branch for your changes.
- Commit your changes and push them to your fork.
- Open a pull request against the main branch of the original repository.
nepdate-cli is released under the GNU General Public License v3.0. See the LICENSE file for more details.
For any inquiries, you can reach out to khumnath cg .