The JewcalGetNearestHolidayGregorianDate function gets the next occurence of a holiday of the current/given date.
If the current/given date directly falls on a holiday, then the same date is returned.
An exception is if the current/given date falls on the second day of the holiday - in this case the first day of the holiday is returned.

DWORD JewcalGetNearestHolidayGregorianDate(BOOL fDiaspora, 
                                           BOOL fPostponeShushanPurim,
                                           LPSTR lpNameFile,
                                           LPJEWCALDATE lpGregorianDate,
                                           LPJEWCALDATE lpReturnGregorianDate,
                                           int iReturnHoliday);


If it is TRUE, calculation for Diaspora is used.
If it is FALSE, calculation for Israel is used.

If it is TRUE and when the 15th of Adar in a non-leap year or the 15th of Adar II in a leap year falls on a Saturday, Shushan Purim is postponed to Sunday.
If it is FALSE, Shushan Purim is always calculated on the 15th of Adar in a non-leap year or the 15th of Adar II in a leap year.

If it is not NULL, it must point to the filename with full path of the NAMES.TXT file.
If it is NULL, the NAMES.TXT file is assumed to have its original name and present in the same directory where JEWCAL.DLL is located.
File format of NAMES.TXT

If it is not NULL, it must point to a JEWCALDATE structure which specifies the Gregorian date to process. If it is NULL, the current date is used.

Must point to a JEWCALDATE structure in which the date of the nearest holiday is returned.

This variable must contain the type of the holiday (JEWCAL_DAY_...) to return


Return values

If the function succeeds, the return value is JEWCAL_ERROR_OK.

If the function fails, the return value is other than JEWCAL_ERROR_OK. The function fails if the passed Gregorian date is invalid or if the NAMES.TXT file could not be found.


This function is new in version 1.1

See Also

JewcalGetNearestHolidayHebrewDate, JewcalGregorianDateToHebrewDate, JewcalGetHebrewMonthName, JEWCALDATE