hebrew calender

ilan

Expert
Licensed User
Longtime User
היי

אני מעוניין לעשות סידור כולל לוח שנה עברי
מצאתי אתר בו קיים CLASS בJAVA
שמאפשר המון אופציות כל מה שקשור לחגים יהודים ועוד הרבה
אני לא כל כך יודע איך להמיר את כל זה לB4A

משהוא כאן יוכל אולי לעזור לי להמיר את הCLASS הזה לB4A??

תודה, אילן

אתר: http://www.kosherjava.com/zmanim/do...calendar/JewishCalendar.html#YOM_YERUSHALAYIM

http://www.kosherjava.com/zmanim/do...im/hebrewcalendar/JewishCalendar.html#line.53
 

ilan

Expert
Licensed User
Longtime User
hi, i just had a look at your bas file and it look very nice.
i just get an error in this line:

B4X:
Public Sub isSabbath(a_GregDateTime As Long) As Boolean
    ' Returns the day of week component from the ticks value.
    ' Values are between 1 To 7. Sunday To Saturday respectively
    Return DateTime.GetDayOfWeek(a_GregDateTime) = bDateTimeUtils.DayOfWeek_Saturday
End Sub

Error: Undecleared variable bDateTimeUtils is used before it was assigned any value.

am i missing a lib?
 

b4auser1

Well-Known Member
Licensed User
Longtime User
Just declare in the module the variable
Public Const DayOfWeek_Saturday As Int = 7

and replace
Return DateTime.GetDayOfWeek(a_GregDateTime) = bDateTimeUtils.DayOfWeek_Saturday
with
Return DateTime.GetDayOfWeek(a_GregDateTime) = DayOfWeek_Saturday
 

ilan

Expert
Licensed User
Longtime User
Just declare in the module the variable
Public Const DayOfWeek_Saturday As Int = 7

and replace
Return DateTime.GetDayOfWeek(a_GregDateTime) = bDateTimeUtils.DayOfWeek_Saturday
with
Return DateTime.GetDayOfWeek(a_GregDateTime) = DayOfWeek_Saturday


שמע זה מדהים מה שעשית, באמת חסכת לי המון זמן, אני קצת ישנה את ה CLASS
אבל ממש מעולה

זה מה שחיפשתי עכשיו אני מוסיף גם זמנים של שקיעה ועלות השחר ויכול לעשות סידור עם לוח שנה עברי

תודה רבה

רק אשמח לקבל את השם שלך :)
 

b4auser1

Well-Known Member
Licensed User
Longtime User
:("היום אני קורא תהילים ורואה "יום טוב" לא "חול
! אני מחפש ורואה את הקוד לא נכון
חנה המודול עם הקוד החדש.
 

Attachments

  • HebrewCalendarUtils.bas
    12.4 KB · Views: 508

ilan

Expert
Licensed User
Longtime User
מעניין אני בדקתי אתמול ולא היו לי בעיות
אך יש לציין ששיניתי שם כמה דברים אבל אני יבדוק שוב

בכל מקרה תודה רבה
 

b4auser1

Well-Known Member
Licensed User
Longtime User
למשל: הקוד הישן עובד לא נכון לחיום (24) כי הסוף של שימחת תורה אתמול (23.
אבל
Return a_iDayFrom <= a_HebDate.m_iDay And a_HebDate.m_iDay <= a_iDayTo + 1

a_iDayTo + 1 = 23 + 1 = 24

והיום מקבלים
a_HebDate = 24
isHoliday_OnMonthDays(a_HebDate, MONTH_Tishrei, 22, 22, 23) = True

גם יש הקוד אחר לכמה חגים אחרים.

B4X:
=== ישן

Private Sub isHoliday_OnDays(a_HebDate As HebDateType, a_iDayFrom As Int, a_iDayTo As Int) As Boolean
    Return a_iDayFrom <= a_HebDate.m_iDay And a_HebDate.m_iDay <= a_iDayTo + 1
End Sub

Public Sub isHoliday_Simchat_Torah(a_HebDate As HebDateType) As Boolean
    'https://en.wikipedia.org/wiki/Simchat_Torah

    Return isHoliday_OnMonthDays(a_HebDate, MONTH_Tishrei, 22, 22, 23)
 
End Sub
=========== חדש

Private Sub isHoliday_OnDays(a_HebDate As HebDateType, a_iDayFrom As Int, a_iDayTo As Int) As Boolean
    Return a_iDayFrom <= a_HebDate.m_iDay And a_HebDate.m_iDay <= a_iDayTo
End Sub

Public Sub isHoliday_Simchat_Torah(a_HebDate As HebDateType) As Boolean
    'https://en.wikipedia.org/wiki/Simchat_Torah
    '22nd (outside of Israel 23rd) day of Tishrei
 
    Return isHoliday_OnMonthDays(a_HebDate, MONTH_Tishrei, 22, 22, 23, 23)
 
End Sub
 

ilan

Expert
Licensed User
Longtime User
נכון אתה צודק עכשיו ראיתי את זה

אבל שאני מוסיף את הקובץ החדש יש לי שגיאה

B4X:
        Dim l_AppPreference As clsBase_AppPreference = bAppUtils.cls_AppPreference
        g_bInIsrael = l_AppPreference.GetBoolean(KeyName_InIsrael, False)
        g_bInJerusalem = l_AppPreference.GetBoolean(KeyName_InJerusalem, False)
 

b4auser1

Well-Known Member
Licensed User
Longtime User
סליחה
חנה המודול הנכון
 

Attachments

  • HebrewCalendarUtils.bas
    11.5 KB · Views: 494
Top