Forum Discussion
NikkiLowin-3dc2
2 months agoCommunity Member
JavaScript help
Can someone help me with coding javascript to display a current date in the following example format: Monday, July 8, 2025.
Appreciate any help and many thanks!
- 2 months ago
I don’t think holding the current date value in a text entry field is a good idea, as it can be easily overridden by the learner’s input. Instead, you can display the current date in a text box by referencing the current_date variable.
The JavaScript code for setting the current date is included in the attached .story file.
Nedim
2 months agoCommunity Member
Execute JavaScript when the timeline starts:
var options = { year: 'numeric', month: 'long', day: 'numeric' };
var currentDate = new Date().toLocaleDateString('en-GB', options);
setVar('currentDate', currentDate);
Ensure there is a custom text variable "currentDate" in your project.
LucyLou
2 months agoCommunity Member
That hasn't worked for me 😔 However I managed to work it out - thank you 😆