'Set `date` value to input pointed by `selector` and `property_name`.'

def set_date(self, property_name, input_selector, date):

    (month, day, year) = map(int, date.split('/'))
    self.click(input_selector)
    if getattr(self, property_name):
        (current_month, current_year) = map(int, getattr(self, property_name).split('/')[1:])
    else:
        (current_month, current_year) = (datetime.datetime.today().month, datetime.datetime.today().year)
    date_diff = (((12 * (year - current_year)) + month) - current_month)
    selector = 'a.ui-datepicker-{}'.format(('next' if (date_diff > 0) else 'prev'))
    for __ in xrange(abs(date_diff)):
        self.page.q(css=selector).click()
    self.page.q(css='a.ui-state-default').nth((day - 1)).click()
    self.page.wait_for_element_invisibility('#ui-datepicker-div', 'datepicker    should    be    closed')
    EmptyPromise((lambda : (getattr(self, property_name) == u'{m}/{d}/{y}'.format(m=month, d=day, y=year))), '{}    is    updated    in    modal.'.format(property_name)).fulfill()
