Convert date into age

Possible to convert a date to age with card script ? with that :
No description
No description
8 Replies
TengoKu
TengoKuOP2w ago
my bad two image
Anthony
Anthony2w ago
Hello Tengo, Why not use a Number bubble with Unit as its Format and year as its Unit? That way users would input their age directly, which would appear like "N years" in the chat. If you still want to stick with them inputting their birth date and getting the time between today and their inputted birth date, honestly any AI knows which JavaScript code to use for that. If I were to do it, I'd just ask Gemini, ChatGPT, Mistral or any AI really and use the JavaScript code it recommends for this use case, inside a Set variable block in Typebot that I'd call "Age". Don't forget to create a variable that will store the inputted date as well. From your screenshot, it seems it wasn't the case currently
No description
TengoKu
TengoKuOP2w ago
I have another question here, I get the year of birth, then convert it to age, and then this age is fetched from a file to bring out the formulas adapted to the age entered, but when I try to display it, it marks me ‘null’ as if a variable wasn't taken into account, but I don't understand why it seems to me that my logic is correct.
No description
No description
No description
TengoKu
TengoKuOP2w ago
I've also checked that the formulas are correct in the Excel file.
TengoKu
TengoKuOP2w ago
i have this error to
No description
TengoKu
TengoKuOP2w ago
there's a problem that I don't understand: I get different amounts in the Excel file that are in the right form but when I display it I get this zero that appears
No description
No description
Baptiste
Baptiste2w ago
There are multiple issues here, can we focus on 1 at a time per thread? How can I easily reproduce that?
TengoKu
TengoKuOP2w ago
I managed to fix the error, in fact when I tried to add everything up at the end of the feed it didn't work, but if I add it up as I go along it does!

Did you find this page helpful?