rn123 / Calendrical-Tools

Calendrical tools for reckoning time.
https://rn123.github.io/Calendrical-Tools/
0 stars 0 forks source link

precompute data for calendars +- given year #1

Open rn123 opened 4 years ago

rn123 commented 4 years ago

For a given year, compute the calendar layout data for year +- 1.

rn123 commented 4 years ago

Currently, compute and store calendrical data for the given year as a dictionary with a key for each calendar type (Gregorian, Islamic, Hebrew, and Chinese). For each calendar type, a list of weeks for the given year is computed and stored. Each week is a dictionary that tracks the ISO week number, raw data, and the date of the new moon occurring during the week (if any) in Gregorian and RD format.

NOTE: RD is the count of days elapsed since 1/1/1 (rata die -- fixed day).

Currently, the isoweeks method has hard-coded numbers to back up to enumerate the days for the week preceding the calendar year. Likewise, isoweeks hard-codes the total number of weeks (54).

rn123 commented 4 years ago

Implement feature to take a number of (civil 7 day) weeks that will be added before and after the data for the calendar year. Make a default so that if a year date is requested then all the weeks of the years before and after the given year are added.

Note: May need to update display functions to output a range of weeks (with default the weeks in the current year).

rn123 commented 4 years ago

Change isoweeks: parameters for the desired number of weeks before and after the calendar year. Make sure core number of weeks include the "54" of the calendar year. Especially, the weeks before should be greater than or equal to one, and weeks after should be greater than or equal to zero beyond the actual ISO weeks in the calendar year. (See Reingold & Dershowitz chapter 5.)

Note: Choose 54 so that the Reingold & Dershowitz displays can be generated.

rn123 commented 4 years ago

TODO: