DateBS
A python/javascript library that converts date from BS to AD and vice versa and is intended to be used in google sheet addon, libreoffice calc extension, pandas.
Use
Google Sheet AddOn/ LibreOffice Calc Extention
The addons expose following custom function so that date from BS to AD and vice versa.
- DateToBS(datestring)
- DateToAD(datestring)
Privacy Policy for Google Sheet Addon
The application only contains custom function for your google sheet and does not store any information of the user anywhere.
The application also adheres to the Google API Services User Data Policy, including the Limited Use requirements.
Google OAuth Scope Requested and their purpose
- https://www.googleapis.com/auth/spreadsheets :: so that the application can manipulate the spreadsheet it is enabled on.
Google App Script Library
ProjectId: M5OVnOjNBAA2Sopb3F1-gozX8b41Gj_r8
Go to Resources > Libraries and add the above library using the above project id.
npm module
npm install datebs
date = require('datebs');
let today = DateBS.fromAD();
console.log(today);
console.log(today.toAD());
deno module
deno install deno.land/x/datebs/index.ts
import { DateBS } from "https://raw.githubusercontent.com/shubhajeet/DateBS/master/src/index.ts";
let today = DateBS.fromAD();
console.log(today);
console.log(today.toAD());
Web App
You can use our dateapi to convert the date from BS to AD and vice versa.
Examples
Get todays date in BS
curl -L https://bit.ly/dateapi
Convert date from BS to AD
curl -L https://bit.ly/dateapi?dateBS=2077-03-01
Convert date from AD to BS
curl -L https://bit.ly/dateapi?dateAD=2020-01-03
python
pip install datebs
Example code
from datebs import DateBS
import argparse
import datetime
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="python -m datebs",description='Convert date from BS to AD and vice-versa')
parser.add_argument('calendar',type=str, help="calendar system in which date is to be displayed [AD|BS]")
parser.add_argument('--date',type=str, help="date opporsite to the calendar system")
args = parser.parse_args()
if (args.calendar == "BS"):
if args.date:
dateBS = DateBS.from_AD(datetime.datetime.strptime(args.date, "%Y-%m-%d"))
else:
dateBS = DateBS.from_AD(datetime.datetime.now())
print(dateBS)
else:
if args.date:
dateBS = DateBS.from_string(args.date)
print(dateBS.to_AD())
else:
print(datetime.datetime.now())