예제 #1
0
파일: views.py 프로젝트: yaacov/hcaldjango
def create_calendar_object(hyear):
    ''' create the libhdate calendar object
        and set it's location and time zone
    '''
    
    hcal = HcalWrapper()
    
    # time calculations use the location
    # some useful locations and time zones:
    #    Eilat : 29, 34, 2
    #    Haifa : 32, 34, 2
    #    Jerusalem : 31, 35, 2
    #    Tel Aviv : 32, 34, 2
    #    Ashdod : 31, 34, 2
    #    Beer Sheva : 31, 34, 2
    #    Tiberias : 32, 35, 2
    #    London : 51, 0, 0
    #    Paris : 48, 2, 1
    #    New York : 40, -74, -5
    #    Moscow : 55, 37, 3
    
    # set location for tel aviv
    longitude = 32.08 # N
    latitude = 34.8 # E
    time_zone = 2 # israel UTC+2
    dst = 0 # DST - daylight saving time
    
    hcal.set_location (longitude, latitude, time_zone + dst)
    
    # set holiday and readings (parasha) for Israel / Diaspory
    hcal.set_israel ()
    #set_diaspora ()
    
    return hcal
예제 #2
0
파일: views.py 프로젝트: yaacov/hcaldjango
def get_year_start(hyear):
    ''' calculate the year's julian and length
    
        return: a tupple of the julian number for 1'st of Tishrey
                and the length of the year
    '''
    
    hcal = HcalWrapper()
    
    # get Julian for year start
    hcal.set_hdate(1, 1, hyear)
    jd_1_tishrey = hcal.get_julian()
    hyear_length = hcal.get_size_of_year()
    
    return (jd_1_tishrey, hyear_length)
예제 #3
0
파일: views.py 프로젝트: yaacov/hcaldjango
def get_calendar_header(hyear):
    ''' create a header dictionary useful for
        renedring the calendar first page
    '''
    
    hcal = HcalWrapper()
    
    # get header for year calendar,
    #   calculate Gregorian year for 5 be Iyaar)
    hcal.set_hdate(5, 8, hyear)
    gyear = hcal.get_gyear()
    hyear_length = hcal.get_size_of_year()
    
    # significant dates
    mered_gadol = gyear - 70
    israel = gyear - 1948
    jerusalem = gyear - 1967
    
    # set the header
    header = {
        'hyear' : hcal.int_to_str(hcal.get_hyear()), 
        'gyear' : '%d-%d' % (gyear - 1, gyear),
        'mered_gadol' : mered_gadol,
        'israel' : israel,
        'jerusalem' : jerusalem,
        'hebrew_year_length' : hyear_length
    }
    
    return header