Shalom, I am creating some pastoral care software for synagogues. One feature is the tracking of anniversary dates of life events - simchas, yahrzeits, etc. For this, I allow the user to set a reminder in advance of that date - 'Remind me x days before the anniversary date'. So, I may need to know the number of days in the previous month (or months). Eg. If the special event occurs 2nd Tishrei, and the reminder is 7 days before, I need to know first what month that would be (inc. accommodations for leap year Adar II) and how many days in the previous month.
Given that the number of days in several Hebrew months varies and with leap years, so does the number of months, I'm looking for a reliable mathematical way to programmatically calculate the number of days in the preceding month of that given Hebrew year.
Any help would be much appreciated.