npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bangla-support

v3.0.0

Published

Utility functions for Bangla (Bengali) digits and the Bangla calendar — dates, months, seasons and weekdays for Bangladesh (BD) and India (IN).

Readme

bangla-support

npm version CI license: MIT types included

Utility functions for Bangla (Bengali) digits and the Bangla calendar — dates, months, seasons and weekdays for Bangladesh (BD) and India (IN). Zero dependencies, ESM, fully typed.

Installation

npm install bangla-support

Requires Node.js >= 20.17. The package is ESM-only (import); modern Node can also require() it.

Quick start

import {getBanglaDate, getBanglaDigit, isBanglaDigit} from 'bangla-support'

getBanglaDate(new Date('2026-04-14T10:00:00+06:00'))
// 'মঙ্গলবার, ১ বৈশাখ, ১৪৩৩'

getBanglaDigit(1234567890) // '১২৩৪৫৬৭৮৯০'
isBanglaDigit('১২৩৪')      // true

The timezone contract

An input Date is an absolute instant. The output is the Bangla date at that instant in the selected country's timezoneAsia/Dhaka (UTC+6:00) for country: 'BD' (the default), Asia/Kolkata (UTC+5:30) for country: 'IN'.

This means the result does not depend on the machine or browser timezone. If it is 9 PM on April 13 in New York, it is already past midnight on April 14 in Dhaka — so getBanglaDate() correctly reports ১ বৈশাখ, the new year. Every function in this package follows the same rule.

API

All calendar functions share the signature fn(date?, options?):

  • date — a Date (defaults to new Date()). Anything that is not a valid Date throws Error('Invalid Date').
  • options.country'BD' (default) or 'IN'.
  • options.format — a format token, where noted below.

getBanglaDate(date?, options?)

The composed, formatted Bangla date.

getBanglaDate(new Date('2026-04-14T10:00:00+06:00'))
// 'মঙ্গলবার, ১ বৈশাখ, ১৪৩৩'  (default format: 'eeee, D MMMM, YYYY')

getBanglaDate(new Date('2026-04-14T10:00:00+06:00'), {format: 'DD-MM-YY'})
// '০১-০১-৩৩'

Format tokens

| Token | Meaning | Example output | |-------|---------|----------------| | eeee | full weekday | মঙ্গলবার | | eee | short weekday | মঙ্গল | | D | day of month | ১ | | DD | day, zero-padded | ০১ | | M | month number | ১ | | MM | month number, zero-padded | ০১ | | MMMM | month name | বৈশাখ | | YY | 2-digit year | ৩৩ | | YYYY | full year | ১৪৩৩ | | YYYYb | year with era suffix | ১৪৩৩ (বঙ্গাব্দ) |

Format-string limitations: tokens are replaced by sequential, case-insensitive matching. A lowercase token (d, mm, yyyy) is recognized but renders the default variant of its group (D, MMMM, YYYY). There is no escape syntax — literal d/e/m/y letters in a format string will be treated as tokens, so stick to separators like spaces, commas, dashes and Bangla text.

getBanglaDay(date?, options?)

Day of the Bangla month. format: 'D' (default) or 'DD'.

getBanglaDay(new Date('2026-04-14T10:00:00+06:00'))                 // '১'
getBanglaDay(new Date('2026-04-14T10:00:00+06:00'), {format: 'DD'}) // '০১'

getBanglaMonth(date?, options?)

Bangla month. format: 'MMMM' (default), 'MM', or 'M'.

getBanglaMonth(new Date('2026-04-14T10:00:00+06:00'))                // 'বৈশাখ'
getBanglaMonth(new Date('2026-04-14T10:00:00+06:00'), {format: 'M'}) // '১'

getBanglaYear(date?, options?)

Bangla year (বঙ্গাব্দ). format: 'YYYY' (default), 'YY', or 'YYYYb'.

getBanglaYear(new Date('2026-04-14T10:00:00+06:00'))                    // '১৪৩৩'
getBanglaYear(new Date('2026-04-14T10:00:00+06:00'), {format: 'YYYYb'}) // '১৪৩৩ (বঙ্গাব্দ)'

getBanglaDayName(date?, options?)

Weekday name. format: 'eeee' (default, full) or 'eee' (short).

getBanglaDayName(new Date('2026-04-14T10:00:00+06:00'))                  // 'মঙ্গলবার'
getBanglaDayName(new Date('2026-04-14T10:00:00+06:00'), {format: 'eee'}) // 'মঙ্গল'

getBanglaSeason(date?, options?)

The season (ঋতু) — one of the six Bangla seasons, two months each. A format option, if passed, is ignored.

getBanglaSeason(new Date('2026-07-06T12:00:00+06:00')) // 'বর্ষা'

getBanglaDigit(digit?)

Convert Latin digits to Bangla numerals. Non-digit characters pass through unchanged. With no argument, returns the (frozen) array of the ten Bangla digit characters.

getBanglaDigit(2026)    // '২০২৬'
getBanglaDigit(3.14)    // '৩.১৪'
getBanglaDigit(0)       // '০'
getBanglaDigit('ID-42') // 'ID-৪২'
getBanglaDigit()        // ['০','১','২','৩','৪','৫','৬','৭','৮','৯']

isBanglaDigit(value)

true when the value consists only of Bangla digit characters.

isBanglaDigit('১২৩') // true
isBanglaDigit('123') // false
isBanglaDigit('১2৩') // false

getBanglaDays(format?), getBanglaMonths(), getBanglaSeasons()

The constant lists. Returned arrays are frozen — copy before mutating.

getBanglaDays()        // ['রবি', 'সোম', 'মঙ্গল', ...]
getBanglaDays('eeee')  // ['রবিবার', 'সোমবার', 'মঙ্গলবার', ...]
getBanglaMonths()      // ['বৈশাখ', 'জ্যৈষ্ঠ', ...]
getBanglaSeasons()     // ['গ্রীষ্ম', 'বর্ষা', ...]

BD vs IN calendars

  • country: 'BD' follows the revised Bangladesh calendar (Bangla Academy, 2019): fixed month lengths, new year on April 14, Falgun gaining a day in Gregorian leap years. The test suite verifies it against published dates (পহেলা বৈশাখ, একুশে ফেব্রুয়ারি = ৮ ফাল্গুন, and every month start).
  • country: 'IN' approximates the astronomical (Surya Siddhanta-style) Bengali calendar used in West Bengal. Because published panjikas differ by tradition (and sometimes by a day), this mode's output is pinned by tests but not certified against a single authority.

Contributing

See CONTRIBUTING.md. Bug reports with a failing date example are especially welcome.

License

MIT © Abdur Rahman Robin