Skip to content

skshetry/bscal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bikram Sambat Calendar

Installation

pip install bscal     # or: pipx install bscal

bscal

$ bscal
     Poush 2080
Su Mo Tu We Th Fr Sa
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29

Pass year for a year view, year month for a single month.

bsdate

$ bsdate                          # now
Tue Poush 17 09:14:14 +0545 2080

$ bsdate 2016-09-08               # AD date
Thu Bhadra 23 09:17:21 +0545 2073

$ bsdate 1473305798               # unix timestamp
Thu Bhadra 23 09:21:38 +0545 2073

$ bsdate -c 2073-05-23            # BS to AD
Thu Sep  8 09:19:00 +0545 2016

Flags: -I[FMT] for ISO 8601 (date|hours|minutes|seconds), +FORMAT for BS-aware strftime, -u for UTC.

Python

BSDate is a datetime.date for Bikram Sambat. Same constructors, accessors, arithmetic, ordering. strftime tokens are BS-aware.

from datetime import date
from bscal import BSDate, bs_to_ad, ad_to_bs

BSDate.today()
BSDate.fromisoformat("2081-01-01")
BSDate.from_ad(date(2024, 4, 13)).to_ad()

bs_to_ad(2081, 1, 1)         # (y, m, d) -> date
ad_to_bs(date(2024, 4, 13))  # date -> (y, m, d)

bscal.cal is the stdlib calendar for BS: isleap, leapdays, weekday, monthrange, month_name, month_abbr, and a BSCalendar (subclass of calendar.TextCalendar).

About

CLI for Nepali Calendar(BS) & Date Conversion Utilities

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages