10 lines
1.0 KiB
Plaintext
10 lines
1.0 KiB
Plaintext
(*Mathematica makes it easy to get month names and day names for several standard calendars.*)
|
|
MonthNames[]:=MonthNames["Gregorian"];
|
|
MonthNames[calType_]:=Lookup[CalendarData[calType,"PropertyAssociation"],"MonthNames"];
|
|
|
|
WeekdayNames[]:=WeekdayNames["Gregorian"];
|
|
WeekdayNames[calType_]:=Lookup[CalendarData[calType,"PropertyAssociation"],"DayNames"];
|
|
|
|
(*Since month boundaries don't align with week boundaries on most calendars, we need to pad month data with empty cells. I was tempted to create a function that would generate offsets for a given year on a given calendar, but even that required too many decisions on the part of the calendar maker to be feasible. So, I removed all of the calendar semantics. If you provide the fixed small group length (week length), the initial offset, and the list of the large group lengths (month lengths), this function will give you the offsets you need for each large group (month).*)
|
|
Offsets[groupLength_,firstOffset_,lengths_List]:=FoldPairList[{#1,Mod[#1+#2,groupLength]}&,firstOffset,lengths];
|