Forum Discussion

ElysBank-da9752's avatar
ElysBank-da9752
Community Member
1 day ago

Need help extracting Day, Month, and Year from the FlatPickr calendar

Hi! I need a little JavaScript help. I've got the FlatPickr calendar working, but I need to separate out the date components so that I can add 30 days to display a deadline.

I've tried Google and ChatGPT, but I can't make it work. 

Anyone have the solution I can add to my JavaScript to pull the information from the date and assign those to my variables?

Or anyone think I am going about this all wrong? Wouldn't be the first time!

Thank you for any suggestion or JavaCoaching. :)

2 Replies

    • Nedim's avatar
      Nedim
      Community Member

      Since the script used in your file is my script originally posted in another thread as a response to someone else’s question, I was able to adjust it so the selected date is now extracted into separate Storyline variables for Day, Month, and Year.

      There are two versions included in the file:

      • the active version sets the Month as a number
      • the alternative version sets the Month as text (e.g., "May")


      If you want to use the text version, make sure the Storyline Month variable is changed from a Number variable to a Text variable.