tg_bot/keyboards/DateToBookingKeyboard.py

26 lines
800 B
Python
Raw Normal View History

2024-12-06 14:20:29 +03:00
from datetime import datetime, timedelta
from bot.Keyboard import Keyboard
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
class DateToBookingKeyboard(Keyboard):
def get_keyboard(self):
current_day = datetime.now()
keyboard = []
for i in range(1, 8):
keyboard.append(
[
InlineKeyboardButton(current_day.strftime("%d.%m.%Y"),
callback_data="set_date={date}".format(date=current_day.strftime("%d.%m.%Y")))
]
)
current_day = current_day + timedelta(days=1)
keyboard.append(
[
InlineKeyboardButton("Назад", callback_data="set_date=back")
]
)
return keyboard