https://discord.gg/botpress logo
DateTime input card don't detect any value of date...
# 🌎general
c
DateTime input card don't detect any value of date entered. Tried with 07-01-2026, 07/01/2026.. logging the input value in validation card and always getting
undefined
. Attached screenshot of logs as well. DateTime validation code:
Copy code
function validate(input: { year: number; month: number; day: number; hours: number; minutes: number }): boolean {
  /** Your code starts below */

  const { year, month, day } = input

  // 1. Check raw input types and values
  console.log('--- Date Validation Debug ---')
  console.log('Raw Input:', { year, month, day })
  console.log('Types:', { year: typeof year, month: typeof month, day: typeof day })

  // 2. Check the constructed Date object
  // (Remember: Month 1 in input becomes Index 0 in JS)
  const inputDate = new Date(year, month - 1, day)
  console.log('Constructed inputDate:', inputDate.toString())

  // 3. Check the "Today" comparison point
  const today = new Date()
  today.setHours(0, 0, 0, 0)
  console.log('Comparison "Today" (Midnight):', today.toString())

  const isValidCalendarDate =
    inputDate.getFullYear() === year && inputDate.getMonth() === month - 1 && inputDate.getDate() === day

  console.log('Is valid calendar date logic:', isValidCalendarDate)

  if (!isValidCalendarDate) {
    console.log('FAILED: Invalid Calendar Date (e.g., Feb 31st or non-numeric input)')
    return false
  }

  const isFutureOrToday = inputDate >= today
  console.log('Is today or future:', isFutureOrToday)

  return isFutureOrToday

  /** Your code ends here */
}
https://cdn.discordapp.com/attachments/1108396291060408352/1482058138621448362/image.png?ex=69b591b3&is=69b44033&hm=d5916242c8a117e63ca6c4c832e2c06351b1ab300ce08f328f879e914f46e125& https://cdn.discordapp.com/attachments/1108396291060408352/1482058139070103552/image.png?ex=69b591b3&is=69b44033&hm=4a0079729bb2ecb2fed9f81f056dd347bc9306e4f6e7d7f7c0e28e989bd21bf2&