How do I use existing packages?
# 🤝help
g
I have been trying to use Moment Luxon to calculate and store the next 5 working days. I have used the AI code generator and also Gemini to generate the code and both of the options use the "const { DateTime } = require('luxon')" line to call Luxon. But I keep getting the following error - [Error, Check dependency list! Synchronous require cannot resolve module 'luxon'. This is the first mention of this module!] The Botpress docs says that Moment Luxon, Axios and Lodash are already installed and ready to use. Why do I keep getting these errors?
l
you cannot use require statements use this to get date + 5 days var today = new Date(); var 5daysfromtoday = 120 + today.getHours();
g
I'm trying to calculate the next 5 working days from the current date and save the output in a list variable. I want the user to be able to choose from these dates for an appointment. How can I go about doing this?
l
for (let i = 1; i <= 5; i++) { const nextDay = new Date(); nextDay.setDate(today.getDate() + i); workflow.nextFiveDays.push(nextDay); } console.log(workflow.nextFiveDays); you can then add @workflow.nextFiveDays to a single choice card, it will show up as dropdown