Just like the title says,
I was building a new layout for our data view plus web part that shows upcoming birthdays from a SharePoint list.
I wanted to show the zodiac sign for each person, using HTML codes you can render the signs but the hard part was to figure out the correct sign for each date.
Here is the end result:
1. I created an object that has all the start dates for each sign, with the HTML sign for it and its name (for tooltip):
2. Now, for each date I have I build a number from the month+day, next I loop through all elements of zodiacSigns until I get a value greater than the current date – which means the one before was the correct sign. Then I build the html span with that info:
A lot of work, but I like the result.