Last active
July 13, 2023 11:53
-
-
Save nporteschaikin/ea8fb4a291dcc63270ce to your computer and use it in GitHub Desktop.
Convert a Date object to the Zodiac sign it falls under.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dateToZodiac(date) { | |
x = (date.getMonth() * 100) + date.getDate(); | |
return x >= 221 && x <= 319 ? 'Aries' : x >= 320 && x <= 420 ? 'Taurus' : x >= 421 && x <= 520 ? 'Gemini' : x >= 521 && x <= 622 ? 'Cancer' : x >= 623 && x <= 722 ? 'Leo' : x >= 723 && x <= 922 ? 'Virgo' : x >= 823 && x <= 922 ? 'Libra' : x >= 923 && x <= 1021 ? 'Scorpio' : x >= 1022 && x <= 1121 ? 'Sagittarius' : x >= 1122 && x <= 19 ? 'Capricorn' : x >= 20 && x <= 118 ? 'Aquarius' : x >= 119 && x <= 220 ? 'Pisces' : void 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment