UNPKG

tibetan-date-calculator

Version:

A library to calculate tibetan calendar details. It is based on Svante Janson's paper www2.math.uu.se/~svante/papers/calendars/tibet.pdf

15 lines (12 loc) 545 B
import getTrueDate from './true-date-from-month-count-day'; /** * calculates the julian date from the day count a variant of true_date * @param {number} dayCount - the day count since beginning of epoch defined as dayNo + 30 * monthCount * @return {number} - julian date */ const julianFromTrueDate = (dayCount: number): number => { const monthCount = Math.floor((dayCount - 1) / 30); const calculatedDay = dayCount % 30 || 30; return Math.floor(getTrueDate(calculatedDay, monthCount)); }; export default julianFromTrueDate;