I have practised Vedic astrology since 1979. For most of those years, festival dates came from printed panchangs, and families often argued over which date was right when two almanacs disagreed. Today the same rules can be computed directly from planetary positions, so I published the 2027 dates as an open dataset that anyone can check or reuse.

Dataset (CC BY 4.0, JSON and CSV): https://github.com/astrologerrps-source/hindu-festival-dates-2027

Why the dates move every year

Hindu festivals follow the lunar calendar. Each one is tied to a tithi, a lunar day. A tithi is the time the Moon takes to gain 12° on the Sun, so it runs anywhere from about 19 to 26 hours. It almost never starts at midnight, and it does not line up with civil days.

So "Diwali falls on Kartika Amavasya" is not enough on its own. You also need a rule for which civil day owns that tithi. Those rules are classical, and they differ from festival to festival.

The rules in the dataset

Every row has a rule field that says which test fixed the date:

Rule Meaning Example
udaya The tithi is running at sunrise Raksha Bandhan, Dussehra
noon / madhyahna-overlap The tithi covers midday Ram Navami, Ganesh Chaturthi
sunset The tithi is running at sunset (pradosh) Diwali, Karwa Chauth, Holika Dahan
midnight The tithi covers midnight (nishita) Janmashtami, Maha Shivratri
sankranti The Sun enters a sidereal sign Baisakhi, Vishwakarma Puja
aparahna (shradh) The tithi covers the afternoon Sarva Pitru Amavasya

This is why Holi and Diwali can shift by a day from one source to another: a sunrise rule and a sunset rule give different answers when a tithi starts in the afternoon.

How the positions are computed

  • Sun and Moon longitudes come from Swiss Ephemeris.
  • Positions are sidereal, using the Lahiri ayanamsa, the standard in Indian almanacs.
  • Sunrise and sunset are computed for the reference location in India, in IST.
  • The tithi number is floor((moon_lon - sun_lon) mod 360 / 12) + 1, and I search for its start and end instants by bisection.

A simplified version of the core step:

import swisseph as swe swe.set_sid_mode(swe.SIDM_LAHIRI) def tithi_at(jd_ut): flags = swe.FLG_SIDEREAL sun = swe.calc_ut(jd_ut, swe.SUN, flags)[0][0] moon = swe.calc_ut(jd_ut, swe.MOON, flags)[0][0] return int(((moon - sun) % 360) // 12) + 1 # 1..30 

Once you have tithi start and end times, each festival is a small test: is tithi N running at sunrise, at midday, at sunset or at midnight on this civil day?

Caveat for people outside India

A tithi begins at one instant worldwide, but sunrise does not. A family in Toronto or London can correctly observe a festival on a different date from India. The dataset is for India (IST). For other cities, use a panchang computed for that city.

Use it

Credit "Dr. R.P. Sharma, drrpsharma.com" if you use the data. Corrections and questions are welcome in the GitHub issues.

— Dr. R.P. Sharma, Vedic astrologer since 1979