I asked chat gpt to give me a javascript algorithm to find the zodiac sign. this gives you a hint that your records dont need to have both dates just one date. Then you can find all records that are less than your date (rather than extract days/months just create the year of the date as year zero) and the zodiac sign will be the last one
function getZodiacSign(month, day) {
// Zodiac signs and the last day of each sign in each month
const zodiacSigns = {
āCapricornā: new Date(0, 0, 20), // January 20
āAquariusā: new Date(0, 1, 19), // February 19
āPiscesā: new Date(0, 2, 20), // March 20
āAriesā: new Date(0, 3, 20), // April 20
āTaurusā: new Date(0, 4, 21), // May 21
āGeminiā: new Date(0, 5, 21), // June 21
āCancerā: new Date(0, 6, 22), // July 22
āLeoā: new Date(0, 7, 23), // August 23
āVirgoā: new Date(0, 8, 23), // September 23
āLibraā: new Date(0, 9, 23), // October 23
āScorpioā: new Date(0, 10, 22), // November 22
āSagittariusā: new Date(0, 11, 21), // December 21
āCapricornā: new Date(0, 11, 31) // December 31
};
// Create a date object for the birth date
const birthDate = new Date(0, month - 1, day);
// Find the zodiac sign
for (let sign in zodiacSigns) {
if (birthDate <= zodiacSigns[sign]) {
return sign;
}
}
return 'Capricorn'; // Capricorn starts from December 22 and goes until January 19
}