Function HebDateAdd(strInterval As String, dblNumber As Double, strDate As String)
Dim i As Long, lngDayCounter As Long
Dim lngHebYear As Long, lngHebMonth As Long, lngHebDay As Long
Dim strTempDate As String
Dim boIsNotLeap As Boolean
Select Case DateType(strDate)
Case 0
' לא תאריך
HebDateAdd = ""
Case 1
' תאריך לועזי
Case 2
' תאריך עברי
End Select
Select Case strInterval
Case Is = "י"
strDate = DateAdd("d", dblNumber, strDate)
HebDateAdd = DateToHeb(strDate)
Case Is = "ח"
strDate = HebToDate(strDate)
GregToHeb strDate, lngHebYear, lngHebMonth, lngHebDay
For i = 0 To dblNumber - 1
If lngHebMonth + i > 13 Then
lngHebMonth = lngHebMonth - 13
lngHebYear = lngHebYear + 1
End If
lngDayCounter = lngDayCounter + IIf(IsFullMonth(lngHebYear, lngHebMonth + i) = 1, 30, 29)
If IsLeapYear(lngHebYear) = False And lngHebMonth + i = 7 Then lngDayCounter = lngDayCounter - 29: boIsNotLeap = True
Next
If boIsNotLeap Then
lngDayCounter = lngDayCounter + IIf(IsFullMonth(lngHebYear, lngHebMonth + dblNumber) = 1, 30, 29)
End If
strTempDate = DateAdd("d", lngDayCounter, strDate)
HebDateAdd = DateToHeb(strTempDate)
Case Else
HebDateAdd = ""
End Select
End Function