11---
2- import { fullEnglish , fullHindi , styleOption
2+ import { fullEnglish , fullHindi , styleOption , tithiNames
33} from " @/utils/constants.ts" ;
44import BackIcon from " @/components/Back.astro" ;
55import BaseLayout from " @/layouts/Base" ;
@@ -131,7 +131,7 @@ const timeUnits = vedicData.time_units;
131131 </div >
132132 </div >
133133
134- <script is:inline define:vars ={ { timeUnits , fullEnglish , fullHindi , styleOption }} >
134+ <script is:inline define:vars ={ { timeUnits , fullEnglish , fullHindi , styleOption , tithiNames }} >
135135 const dateInEnglish = new Intl.DateTimeFormat("en-us", fullEnglish);
136136 const samay = new Intl.DateTimeFormat("hi", fullHindi);
137137 const dateInHindi = new Intl.DateTimeFormat("hi", styleOption);
@@ -140,7 +140,6 @@ const timeUnits = vedicData.time_units;
140140 const from = timeUnits.find((u) => u.name === fromUnit);
141141 const to = timeUnits.find((u) => u.name === toUnit);
142142 if (!from || !to) return null;
143-
144143 const seconds = value * from.seconds;
145144 return seconds / to.seconds;
146145 }
@@ -182,30 +181,23 @@ const timeUnits = vedicData.time_units;
182181 const temp = fromUnit.value;
183182 fromUnit.value = toUnit.value;
184183 toUnit.value = temp;
185-
186184 swapButton.classList.toggle("active");
187-
188185 updateResult();
189186 });
190187 }
191-
192188 // Tab functionality
193189 const tabButtons = document.querySelectorAll(".tab-button");
194190 const tabContents = document.querySelectorAll(".tab-content");
195-
196191 tabButtons.forEach((button) => {
197192 button.addEventListener("click", () => {
198193 // Remove active class from all buttons and contents
199194 tabButtons.forEach((btn) => btn.classList.remove("active"));
200195 tabContents.forEach((content) => content.classList.remove("active"));
201-
202196 // Add active class to clicked button
203197 button.classList.add("active");
204-
205198 // Show corresponding tab content
206199 const targetTab = button.dataset.tab;
207200 document.getElementById(`${targetTab}-tab-content`).classList.add("active");
208-
209201 // Call updateResult if switching to converter tab to ensure result is shown if inputs have values
210202 if (targetTab === "converter") {
211203 updateResult();
@@ -217,25 +209,6 @@ const timeUnits = vedicData.time_units;
217209 document.querySelector('.tab-button[data-tab="tithi"]').click(); // Simulate click to activate default tab
218210
219211 // Tithi date display functionality
220- const tithiNames = [
221- "प्रतिपदा",
222- "द्वितीया",
223- "तृतीया",
224- "चतुर्थी",
225- "पंचमी",
226- "षष्ठी",
227- "सप्तमी",
228- "अष्टमी",
229- "नवमी",
230- "दशमी",
231- "एकादशी",
232- "द्वादशी",
233- "त्रयोदशी",
234- "चतुर्दशी",
235- "पूर्णिमा",
236- "अमावस्या"
237- ];
238-
239212 const getLunarDate = (gregorianDate) => {
240213 const day = gregorianDate.getDate();
241214 const lunarDay = ((day - 1) % 15) + 1;
0 commit comments