Calendar data: sources & verification
Where go-bs's calendar data comes from, and why library agreement alone wasn't enough evidence to trust it.
go-bs supports Bikram Sambat years 1979–2100 inclusive. BS month lengths are not computed
from a formula — they follow Nepal's officially published calendar and are recorded as a static,
table-driven dataset in data.go.
Why this needed real verification
Every BS/AD converter is only as good as its calendar data. While researching this package, three actively used, independent open-source calendar libraries were compared against each other and against a live authoritative source — and all three were found to contain real errors in at least a few individual years. Two libraries agreeing with each other was not, by itself, reliable evidence of correctness — two projects can share a common (and equally wrong) upstream data table.
Sources consulted
- amitgaru/nepali-datetime (Python, Apache-2.0) — a CSV of BS month lengths for 1975–2100.
- askbuddie/bikram-sambat (TypeScript, MIT) — an explicit day-count table for 1975–2100.
- puncoz-official/bikram-sambat-js (TypeScript, MIT) — a run-length-encoded table for 1970–2100.
- Hamro Patro, Nepal's most widely used calendar site/app — not open source and not used as copied code, but used as a live, authoritative reference to adjudicate disagreements between the library sources above. Its own data only goes back to BS 2000.
What was found
Cross-comparing two of the libraries across the full 1979–2100 range, they agreed on 123 of 126 years exactly. That level of agreement looks like strong corroboration — but checking specific months directly against Hamro Patro's live data showed agreement between the libraries did not reliably predict correctness: both libraries agreed with each other on BS 2010 Baisakh having 31 days, and were both wrong in an initial, less careful reading of Hamro Patro that misread it as 30 — a rendered-page-text scraping approach that was abandoned in favor of Hamro Patro's underlying structured day-by-day data once the mistake was caught.
Three independent libraries checked, all three found to contain real errors in specific years. Library consensus is not the same thing as correctness.
How the data was actually built
BS 2000–2100 (101 years) was fetched directly from Hamro Patro's internal calendar data — the same structured records its calendar pages render from, pairing each Gregorian day with its Bikram Sambat date. This was fetched for every year in the range and cross-checked for internal consistency (every month resolved to a clean, gap-free day sequence, zero parse errors across 1,212 month-fetches) before being used.
BS 1979–1999 (21 years) predates Hamro Patro's own records, so these years use the amitgaru library's table. As a sanity check, the running total of days across this span was confirmed to land exactly on Hamro Patro's own BS 2000-01-01 anchor date — so the year-boundary dates are corroborated even though individual month lengths within this span aren't independently verified against a live source.
Known limitation: unlike 2000–2100, the 1979–1999 rows have not been checked against a live calendar day-by-day — only cross-validated between two library sources, plus the year-boundary check above. Corrections from anyone with access to physical Patro almanacs for this period are welcome.
Reference date
The package's internal anchor:
BS 1979-01-01 = AD 1922-04-13This is MinBSYear-01-01, chosen so every supported date has a non-negative offset from the
reference. It was derived from amitgaru's documented anchor and cross-checked independently
against the frontend's own bikram-sambat-js library, which returned the same date. The
maximum supported date, BS 2100-12-31, corresponds to AD 2044-04-13, verified directly from
Hamro Patro's data.
Reproducing this data
The extraction above is implemented as a small maintainer tool,
tools/calendar-generator,
which regenerates data.go. It is not part of the library — go-bs itself has no runtime
dependencies and makes no network calls; only this generator does, and only when a maintainer
runs it deliberately.
Contributing a correction
If you're changing calendar data, cite a source that's independently checkable — a live calendar or an official publication, not just another library's table — and see CONTRIBUTING.md.