techgaun / ad-bs-converter

A javascript implementation to convert bikram samvat to anno domini and vice-versa
29 stars 18 forks source link
anno-domini bs-converter date-converter hacktoberfest javascript node node-module

ad-bs-converter npm version Build Status

A javascript implementation to convert bikram samvat to anno domini and vice-versa

If you are looking for ad-bs converter for python, check out ad-bs-converter.py.

Installation

npm install ad-bs-converter --save

Example

var adbs = require("ad-bs-converter");

console.log(adbs.ad2bs("1990/8/10"))
console.log(adbs.bs2ad("2047/4/26"))

outputs

{ ne: 
   { year: '२०४७',
     month: '४',
     day: '२६',
     strMonth: 'श्रावण',
     strShortMonth: 'श्रा',
     dayOfWeek: '५',
     strDayOfWeek: 'शुक्रवार',
     strShortDayOfWeek: 'शुक्र',
     strMinDayOfWeek: 'शु',
     totalDaysInMonth: '३२'},
  en: 
   { year: 2047,
     month: 4,
     day: 26,
     strMonth: 'Shrawan',
     strShortMonth: 'Shra',
     dayOfWeek: 5,
     strDayOfWeek: 'Shukrabaar',
     strShortDayOfWeek: 'Shukra',
     strMinDayOfWeek: 'Shu',
     totalDaysInMonth: '32' } }
{ year: 1990,
  month: 8,
  strMonth: 'August',
  strShortMonth: 'Aug',
  day: 10,
  dayOfWeek: 5,
  strDayOfWeek: 'Friday',
  strShortDayOfWeek: 'Fri' }