Giter Club home page Giter Club logo

Comments (5)

artembakhanov avatar artembakhanov commented on July 21, 2024

Hello! Thank you for the message. I could not repeat this. Can you please provide an example of code where min_date does not work properly?

For now, I can only say that you might have not specified min_date when creating a calendar object inside a query handler.
You need to pass all the arguments every time you create a calendar.

@bot.message_handler(commands=['start'])
def start(m):
    calendar, step = DetailedTelegramCalendar(min_date=date.today()).build()
    bot.send_message(m.chat.id,
                     f"Select {LSTEP[step]}",
                     reply_markup=calendar)


@bot.callback_query_handler(func=DetailedTelegramCalendar.func())
def cal(c):
    result, key, step = DetailedTelegramCalendar(min_date=date.today()).process(c.data)
    if not result and key:
        bot.edit_message_text(f"Select {LSTEP[step]}",
                              c.message.chat.id,
                              c.message.message_id,
                              reply_markup=key)
    elif result:
        bot.edit_message_text(f"You selected {result}",
                              c.message.chat.id,
                              c.message.message_id)

from python-telegram-bot-calendar.

ssrebelious avatar ssrebelious commented on July 21, 2024

Thanks, indeed I haven't specified min_date in the query handler.

Is there a way to setup calendar with dynamic min and max dates in a DRY way?

from python-telegram-bot-calendar.

ssrebelious avatar ssrebelious commented on July 21, 2024

Посмотрел ваш профиль) Привет из Центра геоинформационных систем УИ 👋

from python-telegram-bot-calendar.

artembakhanov avatar artembakhanov commented on July 21, 2024

Is there a way to setup calendar with dynamic min and max dates in a DRY way?

The module does not support it. But the easiest way that comes to my mind is to create a function that will create a calendar object, so you will need to call the function twice.

If you have any ideas how I can improve it I will be happy to see them:)

Посмотрел ваш профиль) Привет из Центра геоинформационных систем УИ 👋

Привет👋 Приятно видеть людей из УИ)

from python-telegram-bot-calendar.

artembakhanov avatar artembakhanov commented on July 21, 2024

Feel free to reopen this issue

from python-telegram-bot-calendar.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.