New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ad-bs-engine

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ad-bs-engine

A simple JavaScript package to convert dates between AD & BS and provide the basis for BS calendar generation.

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

ad-bs-engine

A simple JavaScript package to convert dates between AD & BS and provide the basis for BS calendar generation.

Installation

npm i ad-bs-engine

Import

import { getAdFromBs, getBsFromAd, getBsMonthInfo } from "ad-bs-engine";

Features & Usage

  • Convert date from BS to AD (BS->AD)

    const dateInAd = getAdFromBs(2081, 10, 2);
    console.log(dateInAd);
    
  • Convert date from AD to BS (AD->BS)

    const dateInBs = getBsFromAd(2025, 1, 14);
    console.log(dateInBs);
    
  • Get month info i.e. total days and starting weekday

    // Sample code to generate calendar for Kartik month of 2082 BS
    const { totalDays, firstWeekday } = getBsMonthInfo(2082, 6);
    
    const weekdays = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
    const calendar = [];
    
    for (let i = 0; i < totalDays; i++) {
      const weekday = weekdays[(firstWeekday + i) % 7];
      const day = i + 1;
      calendar.push({ weekday, day });
    }
    
    console.table(calendar);
    

NOTE

Months are zero-based: 0 = January/Baishak (1st month), 11 = December/Chaitra (12th month).
Weekdays are zero-based: 0 = Sunday, 6 = Saturday.

CAUTION

Not all BS & AD years are supported out of the box.
To support a specific year, add its configuration to mapping.js.

Keywords

bikram-sambat

FAQs

Package last updated on 28 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts