Nepali Date API

A fast, static-hosted JSON API and Web Library for Gregorian (AD) to Bikram Sambat (BS) date conversions. Built for GitHub Pages.

Architecture Note: This API is designed to be hosted on Cloudflare Pages. It uses Cloudflare Functions (Edge Workers) to dynamically evaluate incoming API requests and return raw JSON or text instantly, acting exactly like a true backend server.

GET /api/today.json

Returns today's date in both AD and BS formats as a pure JSON payload. Updated daily via pipeline.

{
  "status": "success",
  "data": {
    "ad": {
      "date": "2024-05-14",
      "year": 2024,
      "month": 5,
      "day": 14
    },
    "bs": {
      "date": "2081-02-01",
      "year": 2081,
      "month": 2,
      "day": 1,
      "daysInMonth": 32,
      "daysTillMonthEnd": 31
    }
  },
  "meta": {
    "generatedAt": "2024-05-14T00:00:00Z"
  }
}

Simple Text Endpoints

If you just want the raw values (without JSON parsing), you can hit these plain text files directly (no HTML will be returned):

GET /api/convert

Browser-based JSON endpoint for converting specific dates. Pass ?ad=YYYY-MM-DD or ?bs=YYYY-MM-DD.

// Click convert to see results

Client-Side JS SDK

For seamless integration in your frontend apps, simply include the CDN script.

<script src="./assets/js/nepali-date-converter.umd.js"></script>

<script>
  const converter = window['@sbmdkl/nepali-date-converter'];

  // Convert AD to BS
  const bsDate = converter.adToBs('2026-05-14');
  console.log(bsDate); // Output: "2083-01-31"

  // Convert BS to AD
  const adDate = converter.bsToAd('2083-01-31');
  console.log(adDate); // Output: "2026-05-14"
</script>