Created
September 11, 2025 16:38
-
-
Save torchipeppo/628d4b65160ac0f467c1aec521f6da4f to your computer and use it in GitHub Desktop.
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
| _get_full_moon_countdown_str() { | |
| let today = new_midnight_date(); | |
| let lunar_calendar = JSON.parse(this.file_handler.get_file_text(this._get_fpath())); | |
| // find the first full or new moon that is today or later, | |
| // but also stop if today is any other "important" phase | |
| // b/c that's a special message | |
| let i = lunar_calendar.month_index[today.getMonth()]; | |
| while (true) { | |
| let i_date = new_midnight_date(lunar_calendar.calendar[i][0]); | |
| if (today.getTime() == i_date.getTime()) { | |
| return CONSTANTS.MOON_PHASE_SHORTNAMES[lunar_calendar.calendar[i][1]]; | |
| } | |
| if (today < i_date && (lunar_calendar.calendar[i][1] == "full" || lunar_calendar.calendar[i][1] == "new")) { | |
| let days_left = Math.round((i_date - today) / (1000 * 60 * 60 * 24)); | |
| return SU.countdown_formatting(days_left); | |
| } | |
| i += 1; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment