#calendar #date #convert #english #utc #gregorian #nepali

adtobs

A Rust crate for effortless conversion of dates between the Gregorian (English) calendar and the Nepali calendar (Bikram Sambat)

3 releases

0.1.2 Mar 7, 2024
0.1.1 Nov 29, 2023
0.1.0 Nov 29, 2023

#309 in Date and time

Download history 63/week @ 2024-07-27 19/week @ 2024-09-21 9/week @ 2024-09-28

62 downloads per month

GPL-3.0 license

17KB
266 lines

Nepali Date Converter

A Rust crate for converting dates from the Gregorian calendar to the Nepali calendar (Bikram Sambat).

Features

  • get_todays_np_date: Get today's date in the Nepali calendar.
  • convert_ad_to_bs: Convert a Gregorian (English) date to a Nepali date.
  • convert_utc_to_bs: Convert a UTC date string to a Nepali date.

Usage

Add this crate to your Cargo.toml:

[dependencies]
adtobs = "0.1.0"

Examples

Get Today's Nepali Date

use adtobs::get_todays_np_date;

let nepali_date = get_todays_np_date();
println!("Today's Nepali Date: {}", nepali_date);

Convert Gregorian Date to Nepali Date

use adtobs::convert_ad_to_bs;

let nepali_date = convert_ad_to_bs(2023, 11, 29);
println!("Nepali Date: {}", nepali_date);

Convert UTC String to Nepali Date

use adtobs::convert_utc_to_bs;

let utc_date = "2023-11-29T12:00:00Z";
let nepali_date = convert_utc_to_bs(utc_date);
println!("Nepali Date: {}", nepali_date);

License

This project is licensed under the GNU General Public License v3.0

Dependencies

~1.4–2.1MB
~28K SLoC