Forum Discussion
Need to set an expiry date for a course created in Articulate Storyline 360
The issue is most likely in your use of external files instead of using triggers inside of Storyline to execute specific JavaScript written in your Storyline project.
I added some variables for you to record a creation date and an expiration date. I use JavaScript to calculate the number of days that have passed since the creation date and the number of days that the course is open for. I also updated your trigger to show the "expired course" slide when the elapsed days is greater than the valid days.
Here is the JavaScript I used, which you can see on the Slide Masters used in your file.
let player = GetPlayer();
var date1 = new Date(player.GetVar("License_CreationDate"));
var date2 = new Date();
var date3 = new Date(player.GetVar("License_ExpirationDate"));
var elapsedTime = date2.getTime() - date1.getTime();
var elapsedDays = elapsedTime/(1000 * 3600 * 24);
var totalTime = date3.getTime() - date1.getTime();
var totalDays = totalTime/(1000 * 3600 * 24);
player.SetVar("License_DaysUsed", elapsedDays);
player.SetVar("License_ValidDays", totalDays);