コード例 #1
0
def set_previous_month(session, context, poll):
    """Show the datepicker keyboard for the previous month."""
    this_month = date.fromisoformat(context.data[2])
    datepicker_context = DatepickerContext(int(context.data[3]))

    previous_month = this_month - relativedelta(months=1)
    update_datepicker(context, poll, datepicker_context, previous_month)
    return i18n.t("callback.date_changed",
                  locale=poll.locale,
                  date=previous_month.isoformat())
コード例 #2
0
def set_next_month(session, context, poll):
    """Show the datepicker keyboard for the next month."""
    this_month = date.fromisoformat(context.data[2])
    datepicker_context = DatepickerContext(int(context.data[3]))

    next_month = this_month + relativedelta(months=1)
    update_datepicker(context, poll, datepicker_context, next_month)
    return i18n.t('callback.date_changed',
                  locale=poll.locale,
                  date=next_month.isoformat())