panchang-ts 4.3.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3671,12 +3671,11 @@ function getUpcomingSolarEclipse(fromUtc, location, withinDays) {
3671
3671
  const observer = makeObserver(location);
3672
3672
  let info = SearchLocalSolarEclipse(fromUtc, observer);
3673
3673
  for (let i = 0; i < 6; i++) {
3674
- const peakMs = info.peak.time.date.getTime();
3675
- const windowEndMs = fromUtc.getTime() + withinDays * 24 * 36e5;
3676
- if (peakMs > windowEndMs + 6 * 36e5) return null;
3677
3674
  const startDate = info.partial_begin.time.date;
3678
3675
  const peakDate = info.peak.time.date;
3679
3676
  const endDate = info.partial_end.time.date;
3677
+ const windowEndMs = fromUtc.getTime() + withinDays * 24 * 36e5;
3678
+ if (startDate.getTime() > windowEndMs) return null;
3680
3679
  if (endDate.getTime() >= fromUtc.getTime()) {
3681
3680
  const subtype = eclipseKindToSubtype(info.kind);
3682
3681
  const sutakStart = new Date(startDate.getTime() - SOLAR_SUTAK_HOURS * 36e5);
@@ -3813,8 +3812,8 @@ function computeChandraMasa(siderealSun, siderealMoon, nameFn, system = "purnima
3813
3812
  const amantaIndex = (solarMonthAtPrev + 1) % 12;
3814
3813
  const amantaName = nameFn(amantaIndex, isAdhika);
3815
3814
  const isKrishnaPaksha = elongation >= 180;
3816
- const purnimantaIndex = isKrishnaPaksha ? (amantaIndex + 1) % 12 : amantaIndex;
3817
- const purnimantaName = nameFn(purnimantaIndex, false);
3815
+ const purnimantaIndex = isKrishnaPaksha && !isAdhika ? (amantaIndex + 1) % 12 : amantaIndex;
3816
+ const purnimantaName = nameFn(purnimantaIndex, isAdhika);
3818
3817
  const index = system === "amanta" ? amantaIndex : purnimantaIndex;
3819
3818
  const name = system === "amanta" ? amantaName : purnimantaName;
3820
3819
  return { index, name, isAdhika, system, amantaIndex, amantaName, purnimantaIndex, purnimantaName };
package/dist/index.d.cts CHANGED
@@ -4448,7 +4448,7 @@ declare function convertHinduToGregorian(coords: {
4448
4448
  *
4449
4449
  * @example
4450
4450
  * ```typescript
4451
- * getKaliYugaYear(new Date('2026-01-01')); // 5127
4451
+ * getKaliYugaYear(new Date('2026-01-01')); // 5126 (before the 18 Feb epoch anniversary)
4452
4452
  * ```
4453
4453
  */
4454
4454
  declare function getKaliYugaYear(date: Date): number;
package/dist/index.d.ts CHANGED
@@ -4448,7 +4448,7 @@ declare function convertHinduToGregorian(coords: {
4448
4448
  *
4449
4449
  * @example
4450
4450
  * ```typescript
4451
- * getKaliYugaYear(new Date('2026-01-01')); // 5127
4451
+ * getKaliYugaYear(new Date('2026-01-01')); // 5126 (before the 18 Feb epoch anniversary)
4452
4452
  * ```
4453
4453
  */
4454
4454
  declare function getKaliYugaYear(date: Date): number;
package/dist/index.js CHANGED
@@ -3669,12 +3669,11 @@ function getUpcomingSolarEclipse(fromUtc, location, withinDays) {
3669
3669
  const observer = makeObserver(location);
3670
3670
  let info = SearchLocalSolarEclipse(fromUtc, observer);
3671
3671
  for (let i = 0; i < 6; i++) {
3672
- const peakMs = info.peak.time.date.getTime();
3673
- const windowEndMs = fromUtc.getTime() + withinDays * 24 * 36e5;
3674
- if (peakMs > windowEndMs + 6 * 36e5) return null;
3675
3672
  const startDate = info.partial_begin.time.date;
3676
3673
  const peakDate = info.peak.time.date;
3677
3674
  const endDate = info.partial_end.time.date;
3675
+ const windowEndMs = fromUtc.getTime() + withinDays * 24 * 36e5;
3676
+ if (startDate.getTime() > windowEndMs) return null;
3678
3677
  if (endDate.getTime() >= fromUtc.getTime()) {
3679
3678
  const subtype = eclipseKindToSubtype(info.kind);
3680
3679
  const sutakStart = new Date(startDate.getTime() - SOLAR_SUTAK_HOURS * 36e5);
@@ -3811,8 +3810,8 @@ function computeChandraMasa(siderealSun, siderealMoon, nameFn, system = "purnima
3811
3810
  const amantaIndex = (solarMonthAtPrev + 1) % 12;
3812
3811
  const amantaName = nameFn(amantaIndex, isAdhika);
3813
3812
  const isKrishnaPaksha = elongation >= 180;
3814
- const purnimantaIndex = isKrishnaPaksha ? (amantaIndex + 1) % 12 : amantaIndex;
3815
- const purnimantaName = nameFn(purnimantaIndex, false);
3813
+ const purnimantaIndex = isKrishnaPaksha && !isAdhika ? (amantaIndex + 1) % 12 : amantaIndex;
3814
+ const purnimantaName = nameFn(purnimantaIndex, isAdhika);
3816
3815
  const index = system === "amanta" ? amantaIndex : purnimantaIndex;
3817
3816
  const name = system === "amanta" ? amantaName : purnimantaName;
3818
3817
  return { index, name, isAdhika, system, amantaIndex, amantaName, purnimantaIndex, purnimantaName };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "panchang-ts",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "Pure TypeScript Hindu Panchang calculations. Tithi, Nakshatra, Yoga, Karana, Vara, and more. Offline-first, React Native compatible.",
5
5
  "author": "Ishank",
6
6
  "license": "MIT",