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 🙏

© 2025 – Pkg Stats / Ryan Hefner

miti-pariwartan

v1.6.4

Published

Miti Pariwartan — Lightweight, accurate Nepali Bikram Sambat (BS) ↔ Gregorian (AD) date converter. Fully offline, supports age calculation, age difference, and human-readable 'time ago' with fromNow().

Downloads

1,435

Readme

Miti Pariwartan — Bikram Sambat ↔ Gregorian Date Converter

Convert Nepali Bikram Sambat (BS) to Gregorian (AD) dates and vice versa, fully offline, no API calls, data powered by local JSON,

✨ Features

  • 🔁 Convert BS → AD and AD → BS
  • 🧮 Calculate Age from a given birth date
  • ➖ Calculate Age Difference between two dates
  • Human-readable time ago / in future with fromNow()
  • 🌐 Works in Node.js, React, Next.js, and Vanilla JS
  • 📦 Dual builds: CommonJS (CJS) + ES Module (ESM)
  • 📅 Supports Nepali date range 2057 BS to 2099 BS

📦 Installation

Using npm:

npm install miti-pariwartan

Using yarn:

yarn add miti-pariwartan

Using CDN:

<script src="https://cdn.jsdelivr.net/npm/miti-pariwartan/lib/index.umd.js"></script>

🚀 Usage Examples

🗓️ Convert BS → AD

import { convertBsToAd } from "miti-pariwartan";

const ad = convertBsToAd("2082-07-26");
console.log(ad.formatted.standard);
// → "2025-11-12"

🗓️ Convert AD → BS

import { convertAdToBs } from "miti-pariwartan";

const bs = convertAdToBs("2025-11-12");
console.log(bs.formatted.standard);
// → "2082-07-26"

🧮 Calculate Age (AD)

import { calculateAge } from "miti-pariwartan";

const age = calculateAge("1990-05-15"); // today = now
console.log(age);
// → { years: 35, months: 5, days: 28 }

➖ Age Difference (AD)

import { calculateAgeDifference } from "miti-pariwartan";

const diff = calculateAgeDifference("1990-05-15", "2025-11-12");
console.log(diff);
// → { years: 35, months: 5, days: 28 }

⏳ fromNow() – Human Readable "Time Ago" / "In Future"

import { fromNow } from "miti-pariwartan";

// Accepts string or Date object (AD only)
console.log(fromNow("2025-11-12"));
// → "10 days ago" (assuming today is 2025-11-22)

console.log(fromNow(new Date()));
// → "a few seconds ago"

console.log(fromNow("2025-12-25"));
// → "in 1 month"

console.log(fromNow("2026-05-20"));
// → "in 6 months"

console.log(fromNow("2030-01-01"));
// → "in 4 years"

fromNow Function Output Examples

| Input | Output | | ------------------------ | ------------------- | | less than 20 seconds ago | just now | | 20–59 seconds ago | a few seconds ago | | 1 minute ago | a minute ago | | 3 minutes ago | 3 minutes ago | | 1 hour ago | an hour ago | | 5 hours ago | 5 hours ago | | 1 day ago | yesterday | | 12 days ago | 12 days ago | | 1 month ago | a month ago | | 2 months ago | 2 months ago | | 1 year ago | a year ago | | Next year | in 1 year | | 1 day in the future | tomorrow | | 30 seconds in the future | in a few seconds |

🧩 Supported Input Formats

| Type | Example | Works With | | -------------------------- | ------------------------------------- | ---------------------------------- | | String (dash) | "2025-10-17" | All functions | | String (slash) | "2025/10/17" | All functions | | String (dot) | "2025.11.12" / "2082.07.26" | All functions | | String (space) | "2025 11 12" / "2082 07 26" | All functions | | Full date string | "Fri Nov 07 2025 08:19:22 GMT+0545" | AD → BS, calculateAge, fromNow | | ISO string | "2025-11-07T00:00:00Z" | AD → BS, calculateAge, fromNow | | Object (1-based month) | { year: 2082, month: 6, day: 31 } | BS ↔ AD conversion only | | Date object | new Date("2025-10-17") | AD → BS, calculateAge, fromNow |

Invalid or out-of-range dates throw clear errors.


Made with ❤️ for the Nepali developer community.