UtilitySansar

Methodology

How we convert Nepali dates (BS ↔ AD)नेपाली मिति कसरी रूपान्तरण गरिन्छ

The Bikram Sambat (BS) calendar is a lunisolar system whose month lengths vary year by year, so a fixed formula is not enough. This page documents the reference data, the epoch, the supported range, and the edge cases the UtilitySansar converter handles.

Why a lookup table?

Unlike the Gregorian calendar, where month lengths are fixed (with February as the only exception), Bikram Sambat months can vary in length from one year to the next. Baisakh in BS 2080 might have 31 days while Baisakh in BS 2081 has 30. There is no closed-form formula that derives these lengths — they are determined astronomically and published by the Government of Nepal.

For that reason, the converter uses a precomputed table of month lengths for every supported BS year, validated against published Nepali pātros (calendars).

Epoch and anchor date

The reference anchor used by the converter is:

  • BS 1975, Baisakh 113 April 1918 (AD), treated as a UTC date.

From this anchor, every later BS date is computed by summing the month-length table; every AD date is computed by adding the day offset, in milliseconds, in UTC. Working in UTC eliminates daylight-saving and timezone drift that can otherwise cause a one-day error near midnight.

Supported range

  • BS 1975 to BS 2099 (approximately AD 1918 to AD 2042).
  • Inputs outside this range raise an explicit error — the converter does not silently extrapolate, because month lengths beyond 2099 are not yet officially published.
  • Dates inside the range are validated against the actual month-length table — for example, BS 2080 Mangsir 31 is rejected if Mangsir 2080 has only 30 days.

How a conversion runs

  1. BS → AD: Sum the days from the BS epoch to the requested BS date using the month-length table, then add that many days (in UTC milliseconds) to the anchor AD date. The result is read back as a UTC year/month/day.
  2. AD → BS: Compute the day offset between the requested AD date (in UTC) and the anchor AD date. Walk the BS month-length table forward from BS 1975 until the cumulative day count matches.
  3. Weekday: Derived from the AD date using JavaScript's native UTC weekday, then mapped to both the English and Nepali weekday names.
  4. Calendar grid: The visible month grid is built by converting each BS day-of-month to its AD counterpart so that holidays and English dates can be shown side by side.

Privacy & where the math runs

All conversions run in your browser. The page does not call any server-side date API, and the input dates never leave your device. This makes the converter usable offline once the page has loaded and removes any dependency on third-party calendar services.

Known edge cases

  • 32-day months: Some BS months can have 32 days. The day picker reflects the actual length for the selected month and clamps overflow rather than rolling into the next month.
  • Year-end boundary: A BS year typically begins in mid-April AD. The converter never assumes January 1 alignment.
  • Leap years: Gregorian leap years are handled by JavaScript's native UTC date arithmetic. BS does not use the same leap-year rule, which is another reason a lookup table is required.

Sources & corrections

The month-length table is cross-checked against widely circulated Nepali pātros and public BS↔AD reference projects. If you spot a date that you believe converts incorrectly for a given Nepali pātro, please open an issue with the BS year, month, and day so we can investigate and correct the underlying table.

Try the Nepali Date Converter →