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

bd-date-utils

v1.0.0

Published

Lightweight Bangladeshi date utilities for React apps and vanilla JS projects.

Downloads

3

Readme

bd-date-utils

বাংলাদেশি তারিখ, সময় এবং সংখ্যাকে React কিংবা যেকোনো জাভাস্ক্রিপ্ট প্রোজেক্টে সহজে দেখানোর জন্য তৈরি হালকা একটি ইউটিলিটি প্যাকেজ।

Lightweight Bangladeshi date helpers that lean on modern Intl APIs, export TypeScript types out of the box, and work identically in React, Next.js, Vite, or vanilla JS apps.

✨ Features

  • Locale-aware formatting with sensible defaults for bn-BD & Asia/Dhaka
  • Ready-made helpers for React (formatForReact) plus plain functions
  • Convert English digits to Bangla numerals everywhere with one flag
  • Calendar-friendly breakdowns (toBanglaDateParts, toBanglaCalendarDate)
  • Relative time strings powered by Intl.RelativeTimeFormat
  • Fully typed TypeScript API, bundles ship as both ESM and CJS

📦 Installation

npm install bd-date-utils
# বা
yarn add bd-date-utils

🚀 Quick start

import {
  formatBanglaDate,
  formatBanglaDateTime,
  relativeTimeFromNow
} from "bd-date-utils";

formatBanglaDate(new Date()); // "১৫ নভেম্বর, ২০২৫"
formatBanglaDateTime("2025-12-01T10:30:00Z"); // "১ ডিসেম্বর, ২০২৫, ৪:৩০ PM"
relativeTimeFromNow("2025-11-20"); // "৫ দিনের মধ্যে"

⚛️ React example

import { formatForReact } from "bd-date-utils";

export function PaymentDue({ dueDate }: { dueDate: string }) {
  const date = formatForReact(dueDate, {
    timeStyle: "short"
  });

  return (
    <time dateTime={date.machineValue} aria-label={date.ariaLabel}>
      {date.day} {date.month}, {date.year}
    </time>
  );
}

formatForReact returns:

{
  iso: string;
  localeString: string;
  day: string;
  month: string;
  monthNumber: string;
  year: string;
  weekday: string;
  ariaLabel: string;
  machineValue: string;
}

🧰 API overview

| Helper | What it does | | --- | --- | | formatBanglaDate(date?, options?) | Formats any date in Bangla using dateStyle (long by default). | | formatBanglaDateTime(date?, options?) | Includes timeStyle (defaults to short). | | getBanglaMonthName(input?, opts?) | Month name from a Date, timestamp, ISO string, or month index. | | getBanglaWeekdayName(date?) | Bangla weekday (রবিবার ... শনিবার). | | toBanglaDateParts(date?, options?) | Returns { weekday, day, monthName, monthNumber, year }. | | toBanglaCalendarDate(date?, options?) | Rich object perfect for calendars/detail cards. | | relativeTimeFromNow(target, options?) | Human friendly phrases like "২ দিন আগে". | | convertToBanglaDigits(value) | Converts any digits to Bangla numerals. | | ensureBanglaDigits(record) | Mass-convert every string/number value in an object. | | formatForReact(date?, options?) | Convenience wrapper that adds ariaLabel + machineValue. |

Common options

All formatters share a common subset of options:

| Option | Type | Default | Notes | | --- | --- | --- | --- | | locale | string | "bn-BD" | Use a different locale but still keep Bangla digits if you want. | | timeZone | string | "Asia/Dhaka" | Override when rendering from other regions. | | dateStyle | "full" \| "long" \| "medium" \| "short" | "long" | Passed through to Intl.DateTimeFormat. | | timeStyle | Same as dateStyle | "short" for formatBanglaDateTime | Controls the time portion. | | weekday | "long" \| "short" \| "narrow" | undefined | Include weekday in the formatted string. | | useBanglaDigits | boolean | true | Turn off if you want English numerals with Bangla labels. |

Relative time options

relativeTimeFromNow(target, {
  baseDate?: Date | string | number;
  locale?: string; // defaults to "bn"
  numeric?: "always" | "auto"; // "auto" => "গতকাল", "আগামীকাল"
  style?: "long" | "short" | "narrow";
});

🛠 Development scripts

  • npm run build – bundles ESM + CJS outputs with type declarations.
  • npm run dev – watch mode while iterating on helpers.
  • npm run typecheck – strict TypeScript diagnostics without emitting files.

📄 License

MIT © Kawsar Ahmed