Forum Discussion
Convert systemDate to static txt
That's correct, Phil. However, with this code, the value of the 'dateString' variable will not persist, so during preview, it will keep displaying today's date. When you come back to it tomorrow, it will display 3/28/24. I was trying to achieve something else with less code. The localStorage version should look something like this:
var dateString = localStorage.getItem('certificateDate');
if (!dateString) {
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
dateString = month + "/" + day + "/" + year;
localStorage.setItem('certificateDate', dateString);
}
var player = GetPlayer();
player.SetVar("systemDate", dateString);
This code will run properly in preview as well.
Tina,
I have attached the .story file for reference. Please disregard the first JavaScript trigger, as it always shows the current date.
- PhilMayor2 years agoSuper Hero
Always helps if I read the whole thing
- Nedim2 years agoCommunity Member
Lol... No worries, Phil. Your posts and comments are incredibly valuable here. Asking questions, raising concerns, and correcting mistakes are crucial; it's how we obtain the answers we need.
- TinaDenmark-5582 years agoCommunity Member
OK, do I need to per define certificateDate a Variable first, then add the new script to the JavaScritp link?
var dateString = localStorage.getItem('certificateDate');
if (!dateString) {
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
dateString = month + "/" + day + "/" + year;
localStorage.setItem('certificateDate', dateString);
}var player = GetPlayer();
player.SetVar("systemDate", dateString);Thanks, Tina
- Nedim2 years agoCommunity Member
...'certificateDate' could be anything, no need to declare. Just make sure it's consistent through out the code. It's used twice in this code.
- TinaDenmark-5582 years agoCommunity Member
I’m sorry for the many replies. I don’t know Java and don’t quite understand syntax. I need the hooked on phonics version of what to do.
So, then I need to place certificateDate on my certificate for the date to remain static?
Thanks, Tina
- TinaDenmark-5582 years agoCommunity Member
The story file was not included.
Thanks,
Tina D Denmark CHAM CHAA, MCCT(r)
Sr. Learning Development Specialist
Learning, Leadership, & Organizational Development, Learning Technology Team[Adobe Captivate Specialist (2019 release)][cid:image002.png@01DA803F.48C33AA0]
[cid:image003.png@01DA803F.48C33AA0]
820 West Diamond Ave
Gaithersburg, MD 20878
Email: tdenmark@adventisthealthcare.com
Office: 301.315.3553 | Fax: 301.315.3053
Website: www.AdventistHealthCare.com
[facebook][twitter] [youtube] [LinkedIn] [rss]Need help with Workday Learning?
Please note: All technical/access issues, questions about assignments, or requests for Learning support must be initiated in Ivanti, our IT Ticketing System platform. Either directly into Ivanti or by calling the IT Help Desk at 240-826-6440.
The Learning Technology Team hours are:
Mon. - Th.: 8 am - 4:30 pm
Fridays: 8 am - 3 pm
The Learning Technology Team responds within 5 business days, sooner if possible.