panchang-ts 0.6.0 → 0.6.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/README.md CHANGED
@@ -72,7 +72,7 @@ console.log(result.rahuKalam); // { start: Date, end: Date }
72
72
 
73
73
  // Choghadiya — 8 daytime slots
74
74
  result.choghadiya.day.forEach(slot => {
75
- console.log(slot.name, slot.quality); // "Amrit", "auspicious"
75
+ console.log(slot.name, slot.qualityName); // "Amrit", "Auspicious"
76
76
  });
77
77
 
78
78
  // Panchaka
@@ -95,7 +95,7 @@ result.festivals.forEach(f => {
95
95
 
96
96
  // Gowri Panchangam — 8 daytime slots
97
97
  result.gowriPanchangam.day.forEach(slot => {
98
- console.log(slot.name, slot.quality); // "Amrit", "auspicious"
98
+ console.log(slot.name, slot.qualityName); // "Amrit", "Auspicious"
99
99
  });
100
100
 
101
101
 
@@ -293,6 +293,7 @@ const brahma = computeBrahmaMuhurta(sunrise, sunset); // { start, end }
293
293
  // Gowri Panchangam (varaIndex: 0=Sun … 6=Sat)
294
294
  const gowri = computeGowriPanchangam(sunrise, sunset, nextSunrise, varaIndex,
295
295
  (i) => ['Udyog','Amrit','Roga','Laabh','Shubh','Kaal','Dhan','Chal'][i]!,
296
+ (q) => ({ auspicious: 'Auspicious', inauspicious: 'Inauspicious', neutral: 'Neutral' })[q],
296
297
  );
297
298
  // gowri.day → 8 GowriSlot (sunrise → sunset)
298
299
  // gowri.night → 8 GowriSlot (sunset → next sunrise)
@@ -406,8 +407,9 @@ type ChoghadiyaQuality = 'auspicious' | 'inauspicious' | 'neutral';
406
407
 
407
408
  interface ChoghadiyaSlot extends TimePeriod {
408
409
  index: number;
409
- name: string; // e.g. "Amrit", "Kaal", "Shubh"
410
- quality: ChoghadiyaQuality;
410
+ name: string; // e.g. "Amrit", "Kaal", "Shubh" (localized)
411
+ quality: ChoghadiyaQuality; // programmatic key: 'auspicious' | 'inauspicious' | 'neutral'
412
+ qualityName: string; // localized display name (e.g. "Auspicious", "शुभ", "शुभम्")
411
413
  }
412
414
 
413
415
  interface ChoghadiyaInfo {
@@ -418,9 +420,10 @@ interface ChoghadiyaInfo {
418
420
  // ── Gowri Panchangam ─────────────────────────────────────────────────────────
419
421
 
420
422
  interface GowriSlot extends TimePeriod {
421
- index: number; // 0–7 within the 8-name cycle
422
- name: string; // e.g. "Amrit", "Kaal", "Shubh"
423
- quality: ChoghadiyaQuality;
423
+ index: number; // 0–7 within the 8-name cycle
424
+ name: string; // e.g. "Amrit", "Kaal", "Shubh" (localized)
425
+ quality: ChoghadiyaQuality; // programmatic key: 'auspicious' | 'inauspicious' | 'neutral'
426
+ qualityName: string; // localized display name (e.g. "Auspicious", "शुभ", "शुभम्")
424
427
  }
425
428
 
426
429
  interface GowriInfo {
@@ -452,7 +455,7 @@ interface SpecialYogaInfo {
452
455
  interface FestivalInfo {
453
456
  name: string; // e.g. "Diwali", "Ekadashi"
454
457
  type: 'major' | 'minor' | 'ekadashi' | 'pradosha' | 'sankranti';
455
- description?: string; // For sankranti: "Rashi 3" — the numeric rashi index as a string; look up name from masaNames
458
+ description?: string; // For sankranti: localized rashi name (e.g. "Makara", "मकर")
456
459
  }
457
460
 
458
461
  // Detection rules:
package/dist/index.cjs CHANGED
@@ -2948,27 +2948,29 @@ var GOWRI_QUALITY = [
2948
2948
  ];
2949
2949
  var DAY_START_INDEX = [6, 5, 4, 3, 2, 1, 0];
2950
2950
  var NIGHT_START_INDEX = [2, 1, 0, 7, 6, 5, 4];
2951
- function buildSlots(reference, durationMs, startIndex, nameFn) {
2951
+ function buildSlots(reference, durationMs, startIndex, nameFn, qualityNameFn) {
2952
2952
  const slotMs = durationMs / 8;
2953
2953
  const slots = [];
2954
2954
  for (let i = 0; i < 8; i++) {
2955
2955
  const idx = (startIndex + i) % 8;
2956
+ const quality = GOWRI_QUALITY[idx];
2956
2957
  slots.push({
2957
2958
  start: new Date(reference.getTime() + i * slotMs),
2958
2959
  end: new Date(reference.getTime() + (i + 1) * slotMs),
2959
2960
  index: idx,
2960
2961
  name: nameFn(idx),
2961
- quality: GOWRI_QUALITY[idx]
2962
+ quality,
2963
+ qualityName: qualityNameFn(quality)
2962
2964
  });
2963
2965
  }
2964
2966
  return slots;
2965
2967
  }
2966
- function computeGowriPanchangam(sunrise, sunset, nextSunrise, varaIndex, nameFn) {
2968
+ function computeGowriPanchangam(sunrise, sunset, nextSunrise, varaIndex, nameFn, qualityNameFn) {
2967
2969
  const dayMs = sunset.getTime() - sunrise.getTime();
2968
2970
  const nightMs = nextSunrise.getTime() - sunset.getTime();
2969
2971
  return {
2970
- day: buildSlots(sunrise, dayMs, DAY_START_INDEX[varaIndex], nameFn),
2971
- night: buildSlots(sunset, nightMs, NIGHT_START_INDEX[varaIndex], nameFn)
2972
+ day: buildSlots(sunrise, dayMs, DAY_START_INDEX[varaIndex], nameFn, qualityNameFn),
2973
+ night: buildSlots(sunset, nightMs, NIGHT_START_INDEX[varaIndex], nameFn, qualityNameFn)
2972
2974
  };
2973
2975
  }
2974
2976
 
@@ -3040,27 +3042,29 @@ var CHOGHADIYA_QUALITY = [
3040
3042
  ];
3041
3043
  var DAY_START_INDEX2 = [0, 3, 6, 2, 5, 1, 4];
3042
3044
  var NIGHT_START_INDEX2 = [5, 1, 4, 6, 0, 3, 2];
3043
- function buildSlots2(reference, durationMs, startIndex, nameFn, count) {
3045
+ function buildSlots2(reference, durationMs, startIndex, nameFn, qualityNameFn, count) {
3044
3046
  const slotMs = durationMs / count;
3045
3047
  const slots = [];
3046
3048
  for (let i = 0; i < count; i++) {
3047
3049
  const idx = (startIndex + i) % 7;
3050
+ const quality = CHOGHADIYA_QUALITY[idx];
3048
3051
  slots.push({
3049
3052
  start: new Date(reference.getTime() + i * slotMs),
3050
3053
  end: new Date(reference.getTime() + (i + 1) * slotMs),
3051
3054
  index: idx,
3052
3055
  name: nameFn(idx),
3053
- quality: CHOGHADIYA_QUALITY[idx]
3056
+ quality,
3057
+ qualityName: qualityNameFn(quality)
3054
3058
  });
3055
3059
  }
3056
3060
  return slots;
3057
3061
  }
3058
- function computeChoghadiya(sunrise, sunset, nextSunrise, varaIndex, nameFn) {
3062
+ function computeChoghadiya(sunrise, sunset, nextSunrise, varaIndex, nameFn, qualityNameFn) {
3059
3063
  const dayMs = sunset.getTime() - sunrise.getTime();
3060
3064
  const nightMs = nextSunrise.getTime() - sunset.getTime();
3061
3065
  return {
3062
- day: buildSlots2(sunrise, dayMs, DAY_START_INDEX2[varaIndex], nameFn, 8),
3063
- night: buildSlots2(sunset, nightMs, NIGHT_START_INDEX2[varaIndex], nameFn, 8)
3066
+ day: buildSlots2(sunrise, dayMs, DAY_START_INDEX2[varaIndex], nameFn, qualityNameFn, 8),
3067
+ night: buildSlots2(sunset, nightMs, NIGHT_START_INDEX2[varaIndex], nameFn, qualityNameFn, 8)
3064
3068
  };
3065
3069
  }
3066
3070
 
@@ -3219,7 +3223,7 @@ var FESTIVAL_REGISTRY = [
3219
3223
  // Bhadrapada (5) — end of Pitru Paksha
3220
3224
  { key: "mahalaya_amavasya", masa: 5, tithi: 29, type: "major" }
3221
3225
  ];
3222
- function computeFestivals(tithiIndex, _nakshatraIndex, chandraMasaIndex, isAdhika, _varaIndex, siderealSun, nameResolver) {
3226
+ function computeFestivals(tithiIndex, _nakshatraIndex, chandraMasaIndex, isAdhika, _varaIndex, siderealSun, nameResolver, rashiNameResolver) {
3223
3227
  const results = [];
3224
3228
  if (!isAdhika) {
3225
3229
  for (const rule of FESTIVAL_REGISTRY) {
@@ -3246,10 +3250,11 @@ function computeFestivals(tithiIndex, _nakshatraIndex, chandraMasaIndex, isAdhik
3246
3250
  const degInRashi = siderealSun % 30;
3247
3251
  if (degInRashi < 1) {
3248
3252
  const rashiIndex = Math.floor(siderealSun / 30) % 12;
3253
+ const rashiName = rashiNameResolver ? rashiNameResolver(rashiIndex) : `Rashi ${rashiIndex}`;
3249
3254
  results.push({
3250
3255
  name: nameResolver("sankranti"),
3251
3256
  type: "sankranti",
3252
- description: `Rashi ${rashiIndex}`
3257
+ description: rashiName
3253
3258
  });
3254
3259
  }
3255
3260
  return results;
@@ -3398,6 +3403,7 @@ var en = {
3398
3403
  choghadiyaNames: ["Udveg", "Char", "Labh", "Amrit", "Kaal", "Shubh", "Rog"],
3399
3404
  gowriNames: ["Udyog", "Amrit", "Roga", "Laabh", "Shubh", "Kaal", "Dhan", "Chal"],
3400
3405
  grahaNames: ["Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars"],
3406
+ qualityNames: { auspicious: "Auspicious", inauspicious: "Inauspicious", neutral: "Neutral" },
3401
3407
  specialYogaNames: {
3402
3408
  amrit_siddhi: "Amrit Siddhi Yoga",
3403
3409
  sarvartha_siddhi: "Sarvartha Siddhi Yoga",
@@ -3561,6 +3567,7 @@ var sa = {
3561
3567
  choghadiyaNames: ["\u0909\u0926\u094D\u0935\u0947\u0917", "\u091A\u0930", "\u0932\u093E\u092D", "\u0905\u092E\u0943\u0924", "\u0915\u093E\u0932", "\u0936\u0941\u092D", "\u0930\u094B\u0917"],
3562
3568
  gowriNames: ["\u0909\u0926\u094D\u092F\u094B\u0917", "\u0905\u092E\u0943\u0924", "\u0930\u094B\u0917", "\u0932\u093E\u092D", "\u0936\u0941\u092D", "\u0915\u093E\u0932", "\u0927\u0928", "\u091A\u0932"],
3563
3569
  grahaNames: ["\u0938\u0942\u0930\u094D\u092F", "\u0936\u0941\u0915\u094D\u0930", "\u092C\u0941\u0927", "\u091A\u0928\u094D\u0926\u094D\u0930", "\u0936\u0928\u093F", "\u0917\u0941\u0930\u0941", "\u092E\u0919\u094D\u0917\u0932"],
3570
+ qualityNames: { auspicious: "\u0936\u0941\u092D\u092E\u094D", inauspicious: "\u0905\u0936\u0941\u092D\u092E\u094D", neutral: "\u0938\u093E\u092E\u093E\u0928\u094D\u092F\u092E\u094D" },
3564
3571
  specialYogaNames: {
3565
3572
  amrit_siddhi: "\u0905\u092E\u0943\u0924 \u0938\u093F\u0926\u094D\u0927\u093F \u092F\u094B\u0917",
3566
3573
  sarvartha_siddhi: "\u0938\u0930\u094D\u0935\u093E\u0930\u094D\u0925 \u0938\u093F\u0926\u094D\u0927\u093F \u092F\u094B\u0917",
@@ -3724,6 +3731,7 @@ var hi = {
3724
3731
  choghadiyaNames: ["\u0909\u0926\u094D\u0935\u0947\u0917", "\u091A\u0930", "\u0932\u093E\u092D", "\u0905\u092E\u0943\u0924", "\u0915\u093E\u0932", "\u0936\u0941\u092D", "\u0930\u094B\u0917"],
3725
3732
  gowriNames: ["\u0909\u0926\u094D\u092F\u094B\u0917", "\u0905\u092E\u0943\u0924", "\u0930\u094B\u0917", "\u0932\u093E\u092D", "\u0936\u0941\u092D", "\u0915\u093E\u0932", "\u0927\u0928", "\u091A\u0932"],
3726
3733
  grahaNames: ["\u0938\u0942\u0930\u094D\u092F", "\u0936\u0941\u0915\u094D\u0930", "\u092C\u0941\u0927", "\u091A\u0902\u0926\u094D\u0930", "\u0936\u0928\u093F", "\u0917\u0941\u0930\u0941", "\u092E\u0902\u0917\u0932"],
3734
+ qualityNames: { auspicious: "\u0936\u0941\u092D", inauspicious: "\u0905\u0936\u0941\u092D", neutral: "\u0938\u093E\u092E\u093E\u0928\u094D\u092F" },
3727
3735
  specialYogaNames: {
3728
3736
  amrit_siddhi: "\u0905\u092E\u0943\u0924 \u0938\u093F\u0926\u094D\u0927\u093F \u092F\u094B\u0917",
3729
3737
  sarvartha_siddhi: "\u0938\u0930\u094D\u0935\u093E\u0930\u094D\u0925 \u0938\u093F\u0926\u094D\u0927\u093F \u092F\u094B\u0917",
@@ -3902,7 +3910,8 @@ function getInstantPanchang(date, location, options) {
3902
3910
  chandramasa.isAdhika,
3903
3911
  vara.index,
3904
3912
  siderealSun,
3905
- (key) => t.festivalNames[key] ?? t.misc[key] ?? key
3913
+ (key) => t.festivalNames[key] ?? t.misc[key] ?? key,
3914
+ (idx) => resolveMasaName(idx, lang)
3906
3915
  );
3907
3916
  return {
3908
3917
  timestamp: date,
@@ -3980,12 +3989,14 @@ function getDailyPanchang(date, location, options) {
3980
3989
  (idx) => resolveNakshatraName(idx, lang)
3981
3990
  );
3982
3991
  const brahmaMuhurta = computeBrahmaMuhurta(sunriseUtc, sunsetUtc);
3992
+ const qualityNameFn = (q) => getTranslations(lang).qualityNames[q];
3983
3993
  const choghadiya = computeChoghadiya(
3984
3994
  sunriseUtc,
3985
3995
  sunsetUtc,
3986
3996
  nextSunriseUtc,
3987
3997
  vara.index,
3988
- (idx) => getTranslations(lang).choghadiyaNames[idx]
3998
+ (idx) => getTranslations(lang).choghadiyaNames[idx],
3999
+ qualityNameFn
3989
4000
  );
3990
4001
  const hora = computeHora(
3991
4002
  sunriseUtc,
@@ -3999,7 +4010,8 @@ function getDailyPanchang(date, location, options) {
3999
4010
  sunsetUtc,
4000
4011
  nextSunriseUtc,
4001
4012
  vara.index,
4002
- (idx) => getTranslations(lang).gowriNames[idx]
4013
+ (idx) => getTranslations(lang).gowriNames[idx],
4014
+ qualityNameFn
4003
4015
  );
4004
4016
  const moonriseUtc = getMoonrise(localMidnightUtc, location);
4005
4017
  const moonsetUtc = getMoonset(localMidnightUtc, location);
@@ -4019,7 +4031,8 @@ function getDailyPanchang(date, location, options) {
4019
4031
  chandramasa.isAdhika,
4020
4032
  vara.index,
4021
4033
  siderealSunAtSunrise,
4022
- (key) => t.festivalNames[key] ?? t.misc[key] ?? key
4034
+ (key) => t.festivalNames[key] ?? t.misc[key] ?? key,
4035
+ (idx) => resolveMasaName(idx, lang)
4023
4036
  );
4024
4037
  let tithis;
4025
4038
  let nakshatras;
package/dist/index.d.cts CHANGED
@@ -88,6 +88,8 @@ interface ChoghadiyaSlot extends TimePeriod {
88
88
  index: number;
89
89
  name: string;
90
90
  quality: ChoghadiyaQuality;
91
+ /** Localized display name for the quality (e.g. "शुभ" in Hindi) */
92
+ qualityName: string;
91
93
  }
92
94
  interface ChoghadiyaInfo {
93
95
  /** 8 equal slots from sunrise to sunset */
@@ -100,6 +102,8 @@ interface GowriSlot extends TimePeriod {
100
102
  index: number;
101
103
  name: string;
102
104
  quality: ChoghadiyaQuality;
105
+ /** Localized display name for the quality (e.g. "शुभ" in Hindi) */
106
+ qualityName: string;
103
107
  }
104
108
  interface GowriInfo {
105
109
  /** 8 equal slots from sunrise to sunset */
@@ -502,8 +506,9 @@ declare function computeBrahmaMuhurta(sunrise: Date, sunset: Date): TimePeriod;
502
506
  * @param nextSunrise UTC next-day sunrise Date.
503
507
  * @param varaIndex Weekday index: 0 = Sunday, 6 = Saturday.
504
508
  * @param nameFn Callback returning translated Gowri slot name for index 0–7.
509
+ * @param qualityNameFn Callback returning translated quality name.
505
510
  */
506
- declare function computeGowriPanchangam(sunrise: Date, sunset: Date, nextSunrise: Date, varaIndex: number, nameFn: (index: number) => string): GowriInfo;
511
+ declare function computeGowriPanchangam(sunrise: Date, sunset: Date, nextSunrise: Date, varaIndex: number, nameFn: (index: number) => string, qualityNameFn: (quality: ChoghadiyaQuality) => string): GowriInfo;
507
512
 
508
513
  type PanchangErrorCode = 'INVALID_LATITUDE' | 'INVALID_LONGITUDE' | 'INVALID_ELEVATION' | 'INVALID_DATE' | 'INVALID_TIMEZONE' | 'INVALID_AYANAMSA' | 'TIMEZONE_RESOLUTION_FAILED' | 'NO_SUNRISE' | 'NO_SUNSET' | 'SEARCH_DIVERGED';
509
514
  declare class PanchangError extends Error {
package/dist/index.d.ts CHANGED
@@ -88,6 +88,8 @@ interface ChoghadiyaSlot extends TimePeriod {
88
88
  index: number;
89
89
  name: string;
90
90
  quality: ChoghadiyaQuality;
91
+ /** Localized display name for the quality (e.g. "शुभ" in Hindi) */
92
+ qualityName: string;
91
93
  }
92
94
  interface ChoghadiyaInfo {
93
95
  /** 8 equal slots from sunrise to sunset */
@@ -100,6 +102,8 @@ interface GowriSlot extends TimePeriod {
100
102
  index: number;
101
103
  name: string;
102
104
  quality: ChoghadiyaQuality;
105
+ /** Localized display name for the quality (e.g. "शुभ" in Hindi) */
106
+ qualityName: string;
103
107
  }
104
108
  interface GowriInfo {
105
109
  /** 8 equal slots from sunrise to sunset */
@@ -502,8 +506,9 @@ declare function computeBrahmaMuhurta(sunrise: Date, sunset: Date): TimePeriod;
502
506
  * @param nextSunrise UTC next-day sunrise Date.
503
507
  * @param varaIndex Weekday index: 0 = Sunday, 6 = Saturday.
504
508
  * @param nameFn Callback returning translated Gowri slot name for index 0–7.
509
+ * @param qualityNameFn Callback returning translated quality name.
505
510
  */
506
- declare function computeGowriPanchangam(sunrise: Date, sunset: Date, nextSunrise: Date, varaIndex: number, nameFn: (index: number) => string): GowriInfo;
511
+ declare function computeGowriPanchangam(sunrise: Date, sunset: Date, nextSunrise: Date, varaIndex: number, nameFn: (index: number) => string, qualityNameFn: (quality: ChoghadiyaQuality) => string): GowriInfo;
507
512
 
508
513
  type PanchangErrorCode = 'INVALID_LATITUDE' | 'INVALID_LONGITUDE' | 'INVALID_ELEVATION' | 'INVALID_DATE' | 'INVALID_TIMEZONE' | 'INVALID_AYANAMSA' | 'TIMEZONE_RESOLUTION_FAILED' | 'NO_SUNRISE' | 'NO_SUNSET' | 'SEARCH_DIVERGED';
509
514
  declare class PanchangError extends Error {
package/dist/index.js CHANGED
@@ -2946,27 +2946,29 @@ var GOWRI_QUALITY = [
2946
2946
  ];
2947
2947
  var DAY_START_INDEX = [6, 5, 4, 3, 2, 1, 0];
2948
2948
  var NIGHT_START_INDEX = [2, 1, 0, 7, 6, 5, 4];
2949
- function buildSlots(reference, durationMs, startIndex, nameFn) {
2949
+ function buildSlots(reference, durationMs, startIndex, nameFn, qualityNameFn) {
2950
2950
  const slotMs = durationMs / 8;
2951
2951
  const slots = [];
2952
2952
  for (let i = 0; i < 8; i++) {
2953
2953
  const idx = (startIndex + i) % 8;
2954
+ const quality = GOWRI_QUALITY[idx];
2954
2955
  slots.push({
2955
2956
  start: new Date(reference.getTime() + i * slotMs),
2956
2957
  end: new Date(reference.getTime() + (i + 1) * slotMs),
2957
2958
  index: idx,
2958
2959
  name: nameFn(idx),
2959
- quality: GOWRI_QUALITY[idx]
2960
+ quality,
2961
+ qualityName: qualityNameFn(quality)
2960
2962
  });
2961
2963
  }
2962
2964
  return slots;
2963
2965
  }
2964
- function computeGowriPanchangam(sunrise, sunset, nextSunrise, varaIndex, nameFn) {
2966
+ function computeGowriPanchangam(sunrise, sunset, nextSunrise, varaIndex, nameFn, qualityNameFn) {
2965
2967
  const dayMs = sunset.getTime() - sunrise.getTime();
2966
2968
  const nightMs = nextSunrise.getTime() - sunset.getTime();
2967
2969
  return {
2968
- day: buildSlots(sunrise, dayMs, DAY_START_INDEX[varaIndex], nameFn),
2969
- night: buildSlots(sunset, nightMs, NIGHT_START_INDEX[varaIndex], nameFn)
2970
+ day: buildSlots(sunrise, dayMs, DAY_START_INDEX[varaIndex], nameFn, qualityNameFn),
2971
+ night: buildSlots(sunset, nightMs, NIGHT_START_INDEX[varaIndex], nameFn, qualityNameFn)
2970
2972
  };
2971
2973
  }
2972
2974
 
@@ -3038,27 +3040,29 @@ var CHOGHADIYA_QUALITY = [
3038
3040
  ];
3039
3041
  var DAY_START_INDEX2 = [0, 3, 6, 2, 5, 1, 4];
3040
3042
  var NIGHT_START_INDEX2 = [5, 1, 4, 6, 0, 3, 2];
3041
- function buildSlots2(reference, durationMs, startIndex, nameFn, count) {
3043
+ function buildSlots2(reference, durationMs, startIndex, nameFn, qualityNameFn, count) {
3042
3044
  const slotMs = durationMs / count;
3043
3045
  const slots = [];
3044
3046
  for (let i = 0; i < count; i++) {
3045
3047
  const idx = (startIndex + i) % 7;
3048
+ const quality = CHOGHADIYA_QUALITY[idx];
3046
3049
  slots.push({
3047
3050
  start: new Date(reference.getTime() + i * slotMs),
3048
3051
  end: new Date(reference.getTime() + (i + 1) * slotMs),
3049
3052
  index: idx,
3050
3053
  name: nameFn(idx),
3051
- quality: CHOGHADIYA_QUALITY[idx]
3054
+ quality,
3055
+ qualityName: qualityNameFn(quality)
3052
3056
  });
3053
3057
  }
3054
3058
  return slots;
3055
3059
  }
3056
- function computeChoghadiya(sunrise, sunset, nextSunrise, varaIndex, nameFn) {
3060
+ function computeChoghadiya(sunrise, sunset, nextSunrise, varaIndex, nameFn, qualityNameFn) {
3057
3061
  const dayMs = sunset.getTime() - sunrise.getTime();
3058
3062
  const nightMs = nextSunrise.getTime() - sunset.getTime();
3059
3063
  return {
3060
- day: buildSlots2(sunrise, dayMs, DAY_START_INDEX2[varaIndex], nameFn, 8),
3061
- night: buildSlots2(sunset, nightMs, NIGHT_START_INDEX2[varaIndex], nameFn, 8)
3064
+ day: buildSlots2(sunrise, dayMs, DAY_START_INDEX2[varaIndex], nameFn, qualityNameFn, 8),
3065
+ night: buildSlots2(sunset, nightMs, NIGHT_START_INDEX2[varaIndex], nameFn, qualityNameFn, 8)
3062
3066
  };
3063
3067
  }
3064
3068
 
@@ -3217,7 +3221,7 @@ var FESTIVAL_REGISTRY = [
3217
3221
  // Bhadrapada (5) — end of Pitru Paksha
3218
3222
  { key: "mahalaya_amavasya", masa: 5, tithi: 29, type: "major" }
3219
3223
  ];
3220
- function computeFestivals(tithiIndex, _nakshatraIndex, chandraMasaIndex, isAdhika, _varaIndex, siderealSun, nameResolver) {
3224
+ function computeFestivals(tithiIndex, _nakshatraIndex, chandraMasaIndex, isAdhika, _varaIndex, siderealSun, nameResolver, rashiNameResolver) {
3221
3225
  const results = [];
3222
3226
  if (!isAdhika) {
3223
3227
  for (const rule of FESTIVAL_REGISTRY) {
@@ -3244,10 +3248,11 @@ function computeFestivals(tithiIndex, _nakshatraIndex, chandraMasaIndex, isAdhik
3244
3248
  const degInRashi = siderealSun % 30;
3245
3249
  if (degInRashi < 1) {
3246
3250
  const rashiIndex = Math.floor(siderealSun / 30) % 12;
3251
+ const rashiName = rashiNameResolver ? rashiNameResolver(rashiIndex) : `Rashi ${rashiIndex}`;
3247
3252
  results.push({
3248
3253
  name: nameResolver("sankranti"),
3249
3254
  type: "sankranti",
3250
- description: `Rashi ${rashiIndex}`
3255
+ description: rashiName
3251
3256
  });
3252
3257
  }
3253
3258
  return results;
@@ -3396,6 +3401,7 @@ var en = {
3396
3401
  choghadiyaNames: ["Udveg", "Char", "Labh", "Amrit", "Kaal", "Shubh", "Rog"],
3397
3402
  gowriNames: ["Udyog", "Amrit", "Roga", "Laabh", "Shubh", "Kaal", "Dhan", "Chal"],
3398
3403
  grahaNames: ["Sun", "Venus", "Mercury", "Moon", "Saturn", "Jupiter", "Mars"],
3404
+ qualityNames: { auspicious: "Auspicious", inauspicious: "Inauspicious", neutral: "Neutral" },
3399
3405
  specialYogaNames: {
3400
3406
  amrit_siddhi: "Amrit Siddhi Yoga",
3401
3407
  sarvartha_siddhi: "Sarvartha Siddhi Yoga",
@@ -3559,6 +3565,7 @@ var sa = {
3559
3565
  choghadiyaNames: ["\u0909\u0926\u094D\u0935\u0947\u0917", "\u091A\u0930", "\u0932\u093E\u092D", "\u0905\u092E\u0943\u0924", "\u0915\u093E\u0932", "\u0936\u0941\u092D", "\u0930\u094B\u0917"],
3560
3566
  gowriNames: ["\u0909\u0926\u094D\u092F\u094B\u0917", "\u0905\u092E\u0943\u0924", "\u0930\u094B\u0917", "\u0932\u093E\u092D", "\u0936\u0941\u092D", "\u0915\u093E\u0932", "\u0927\u0928", "\u091A\u0932"],
3561
3567
  grahaNames: ["\u0938\u0942\u0930\u094D\u092F", "\u0936\u0941\u0915\u094D\u0930", "\u092C\u0941\u0927", "\u091A\u0928\u094D\u0926\u094D\u0930", "\u0936\u0928\u093F", "\u0917\u0941\u0930\u0941", "\u092E\u0919\u094D\u0917\u0932"],
3568
+ qualityNames: { auspicious: "\u0936\u0941\u092D\u092E\u094D", inauspicious: "\u0905\u0936\u0941\u092D\u092E\u094D", neutral: "\u0938\u093E\u092E\u093E\u0928\u094D\u092F\u092E\u094D" },
3562
3569
  specialYogaNames: {
3563
3570
  amrit_siddhi: "\u0905\u092E\u0943\u0924 \u0938\u093F\u0926\u094D\u0927\u093F \u092F\u094B\u0917",
3564
3571
  sarvartha_siddhi: "\u0938\u0930\u094D\u0935\u093E\u0930\u094D\u0925 \u0938\u093F\u0926\u094D\u0927\u093F \u092F\u094B\u0917",
@@ -3722,6 +3729,7 @@ var hi = {
3722
3729
  choghadiyaNames: ["\u0909\u0926\u094D\u0935\u0947\u0917", "\u091A\u0930", "\u0932\u093E\u092D", "\u0905\u092E\u0943\u0924", "\u0915\u093E\u0932", "\u0936\u0941\u092D", "\u0930\u094B\u0917"],
3723
3730
  gowriNames: ["\u0909\u0926\u094D\u092F\u094B\u0917", "\u0905\u092E\u0943\u0924", "\u0930\u094B\u0917", "\u0932\u093E\u092D", "\u0936\u0941\u092D", "\u0915\u093E\u0932", "\u0927\u0928", "\u091A\u0932"],
3724
3731
  grahaNames: ["\u0938\u0942\u0930\u094D\u092F", "\u0936\u0941\u0915\u094D\u0930", "\u092C\u0941\u0927", "\u091A\u0902\u0926\u094D\u0930", "\u0936\u0928\u093F", "\u0917\u0941\u0930\u0941", "\u092E\u0902\u0917\u0932"],
3732
+ qualityNames: { auspicious: "\u0936\u0941\u092D", inauspicious: "\u0905\u0936\u0941\u092D", neutral: "\u0938\u093E\u092E\u093E\u0928\u094D\u092F" },
3725
3733
  specialYogaNames: {
3726
3734
  amrit_siddhi: "\u0905\u092E\u0943\u0924 \u0938\u093F\u0926\u094D\u0927\u093F \u092F\u094B\u0917",
3727
3735
  sarvartha_siddhi: "\u0938\u0930\u094D\u0935\u093E\u0930\u094D\u0925 \u0938\u093F\u0926\u094D\u0927\u093F \u092F\u094B\u0917",
@@ -3900,7 +3908,8 @@ function getInstantPanchang(date, location, options) {
3900
3908
  chandramasa.isAdhika,
3901
3909
  vara.index,
3902
3910
  siderealSun,
3903
- (key) => t.festivalNames[key] ?? t.misc[key] ?? key
3911
+ (key) => t.festivalNames[key] ?? t.misc[key] ?? key,
3912
+ (idx) => resolveMasaName(idx, lang)
3904
3913
  );
3905
3914
  return {
3906
3915
  timestamp: date,
@@ -3978,12 +3987,14 @@ function getDailyPanchang(date, location, options) {
3978
3987
  (idx) => resolveNakshatraName(idx, lang)
3979
3988
  );
3980
3989
  const brahmaMuhurta = computeBrahmaMuhurta(sunriseUtc, sunsetUtc);
3990
+ const qualityNameFn = (q) => getTranslations(lang).qualityNames[q];
3981
3991
  const choghadiya = computeChoghadiya(
3982
3992
  sunriseUtc,
3983
3993
  sunsetUtc,
3984
3994
  nextSunriseUtc,
3985
3995
  vara.index,
3986
- (idx) => getTranslations(lang).choghadiyaNames[idx]
3996
+ (idx) => getTranslations(lang).choghadiyaNames[idx],
3997
+ qualityNameFn
3987
3998
  );
3988
3999
  const hora = computeHora(
3989
4000
  sunriseUtc,
@@ -3997,7 +4008,8 @@ function getDailyPanchang(date, location, options) {
3997
4008
  sunsetUtc,
3998
4009
  nextSunriseUtc,
3999
4010
  vara.index,
4000
- (idx) => getTranslations(lang).gowriNames[idx]
4011
+ (idx) => getTranslations(lang).gowriNames[idx],
4012
+ qualityNameFn
4001
4013
  );
4002
4014
  const moonriseUtc = getMoonrise(localMidnightUtc, location);
4003
4015
  const moonsetUtc = getMoonset(localMidnightUtc, location);
@@ -4017,7 +4029,8 @@ function getDailyPanchang(date, location, options) {
4017
4029
  chandramasa.isAdhika,
4018
4030
  vara.index,
4019
4031
  siderealSunAtSunrise,
4020
- (key) => t.festivalNames[key] ?? t.misc[key] ?? key
4032
+ (key) => t.festivalNames[key] ?? t.misc[key] ?? key,
4033
+ (idx) => resolveMasaName(idx, lang)
4021
4034
  );
4022
4035
  let tithis;
4023
4036
  let nakshatras;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "panchang-ts",
3
- "version": "0.6.0",
3
+ "version": "0.6.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",