def is_past_date(date):
    "Is this date in the past?"
    result_flag = True
    date = gcal.process_date_string(date)
    today = gcal.get_today()
    if date >= today:
        result_flag = False
    
    return result_flag
Ejemplo n.º 2
0
def process_time_to_gcal(given_date,hour_offset=None):
    "Process a given string to a gcal like datetime format"
    processed_date = gcal.process_date_string(given_date)
    if hour_offset is not None:
        processed_date = processed_date.replace(hour=int(hour_offset))        
    processed_date = gcal.process_date_isoformat(processed_date)
    processed_date = str(processed_date).replace('Z',TIMEZONE_STRING)

    return processed_date
def is_qxf2_holiday(date):
    "Is this date a Qxf2 holiday?"
    holidays = ['2019-01-01','2019-01-15','2019-03-04','2019-05-01','2019-08-15','2019-09-02','2019-10-02','2019-10-08','2019-11-01']
    #Holiday date format is different to keep it consistent with the JavaScript
    #That way, you can copy paste the same array between the html and here
    holiday_format = '%Y-%m-%d'
    date = gcal.process_date_string(date,holiday_format)
    date = date.strftime(holiday_format)
    result_flag = True if date in holidays else False

    return result_flag
def is_weekend(date):
    "Is this a weekend?"
    date = gcal.process_date_string(date)
    day = date.weekday()
    
    return True if day==5 or day==6 else False