Forum Discussion
compare 2 dates in storyline
I need to compare 2 dates in storyline, test if date users entered is todays date and if not bring error message
- MathNotermans-9Community Member
With Javascript you can.
- DafniDean-a4e6aCommunity Member
thank you for reply
not very familiral with javascript so can you help?
- MathNotermans-9Community Member
I could, but you first have to clarify your needs better. What dates are compared ? How do users enter those ? How is it checked that the dates entered indeed are proper dates ?
If date users entered is todays date = always correct.... because todays date is today :-)
- DafniDean-a4e6aCommunity Member
fantastic thank you so much for your help
- NedimCommunity Member
If the slide layout and time allow, this could be enhanced by enabling the learner to select the date, eliminating the need for them to type and match the required format. A text entry field could easily be used as a date picker, and the selected date could then be compared to the required date. This could be achieved with JavaScript as well.
- DafniDean-a4e6aCommunity Member
thank you so much, can you please give me some more information on how this cna be done
- DafniDean-a4e6aCommunity Member
this is really good do you know how to change the date though to UK version DD MM YYYY
- NedimCommunity Member
The date format displayed by the date picker (or the <input type="date"> field) is usually determined by the user's system locale settings. It uses a browser's native date picker, which is dependent on the language and region settings of the user's operating system or browser. In the US, the date picker might display dates in the format MM/DD/YYYY (e.g., 01/09/2025); in the UK or most of Europe, the format could be DD/MM/YYYY (e.g., 09/01/2025).
In my first example, I integrated the FlatPickr JavaScript library to create a more customizable and feature-rich date picker.
I've attached a simple example for you to explore. It uses the native input field and will most likely display the UK format if your system is set up that way.