def start_end_date_for_period(period, default_start_date=False, default_end_date=False):
 today = date.today()
 if (period == 'daily'):
  start_date = today
  end_date = start_date
 elif (period == 'weekly'):
  start_date = (today + relativedelta(weekday=MO((-1))))
  end_date = (start_date + timedelta(days=7))
 elif (period == 'monthly'):
  start_date = today.replace(day=1)
  end_date = (today + relativedelta(months=1, day=1, days=(-1)))
 elif (period == 'yearly'):
  start_date = today.replace(month=1, day=1)
  end_date = today.replace(month=12, day=31)
 else:
  start_date = default_start_date
  end_date = default_end_date
  return (start_date, end_date)
 return (fields.Datetime.to_string(start_date), fields.Datetime.to_string(end_date))

def start_end_date_for_period ( period , default_start_date = False , default_end_date = False ) : today = date . today ( ) if ( period == 'daily' ) : start_date = today end_date = start_date elif ( period == 'weekly' ) : start_date = ( today + relativedelta ( weekday = MO ( ( - 1 ) ) ) ) end_date = ( start_date + timedelta ( days = 7 ) ) elif ( period == 'monthly' ) : start_date = today . replace ( day = 1 ) end_date = ( today + relativedelta ( months = 1 , day = 1 , days = ( - 1 ) ) ) elif ( period == 'yearly' ) : start_date = today . replace ( month = 1 , day = 1 ) end_date = today . replace ( month = 12 , day = 31 ) else : start_date = default_start_date end_date = default_end_date return ( start_date , end_date ) return ( fields . Datetime . to_string ( start_date ) , fields . Datetime . to_string ( end_date ) )
return the start and end date for a goal period based on today .