VDS13/telegram-inline-calendar

Get the wrong time when calling clickButtonCalendar

alexchekmenev opened this issue · 4 comments

When I call
result = session.calendar.clickButtonCalendar(callbackQuery) to get the time from callbackQuery I receive the wrong time when selecting it from the range 00:00-00:59. For example, I choose 00:15 and result = 'YYYY-MM-DD 12:15' but definitely must be 'YYYY-MM-DD 00:15'. Am I doing something wrong?

VDS13 commented

Hello, @alexchekmenev.
Can you show what parameters you pass when creating an instance of the class?

  const { session } = ctx.scene
  const minDate =
    session.drawSettingsStep === 'startMethod'
      ? dayjs.tz(Date.now(), session.timezone.name)
      : dayjs(session.drawStartsAt).tz(session.timezone.name)
  console.log('minDate', minDate.format('YYYY-MM-DD'))
  session.calendar = new Calendar(ctx, {
    bot_api: 'telegraf',
    language: session.locale,
    date_format: 'YYYY-MM-DD hh:mm',
    start_date: minDate.format('YYYY-MM-DD'),
    stop_date: dayjs(minDate).add(30, 'days').format('YYYY-MM-DD'),
    start_week_day: 1,
    time_selector_mod: true,
    time_range: '00:00-23:59',
    time_step: '15m',
  })
  session.calendar.startNavCalendar(ctx)

Oh, my bad, thank you a lot!