Date Format in Lectora

Displaying Dates in Lectora published titles is dependent on the locale setting. There is no function within the Lectora (Versions ...12/16) user interface to control the date format displayed in a published title.

So here is a simple hack to change the date display format (in this example using standard South African date format):

Please note that this is something you do once the Lectora title has been published to HTML/SCORM

Here the HTML output is used, but the same principle applies to the SCORM published content, keeping in mind that all files will be in a .zip folder.

  • Navigate to the HTML output folder of the title
  • Locate the file trivantis-timedate.js
  • Open the file in a plain text editor (Notepad for example)
  • Here is the code generated by Lectora

/**************************************************

Trivantis (http://www.trivantis.com)

**************************************************/

//functions for realtime date/time

function FormatDS( now ) {

return now.toLocaleDateString()

}

...

remaining code excluded, since only function FormatDS( now ) {...} needs to change

To format the date output to DD MMMM YYY format, replace return now.toLocaleDateString() with the following:

var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

var myDate = new Date();

var myMonth = myDate.getMonth();

return now.getDate() + ' ' + monthNames[myMonth] + ' ' + now.getFullYear();

  • Save the file in the original location

Dates should display in this format 14 March 2016.

A sample of the modified file is attached.

undefined

Discussions have been disabled for this post