Issue with Date variable inconsistent
May 13, 2014 12:00 AM
Hi,
I'm currently using Lectora 10.6 and using the inbuilt date functionality within my course certificates. I'm just using the Lectora native 'CurrentDate' variable. My assumption is this variable is taken from the users computer and not the LMS (I'm using Moodle), is this correct?
Anyway, the issue I'm having is that I'm seeing inconsistencies as to whether the date is shown in American or English format. For example the date 31st March 2014 will sometimes appear as 03/31/2014 or 31/03/2014. This causes a lot of confusion for my admin staff especially when the month date is smaller than 12 (i.e. 04/03/2014).
Has anyone else received this issue and found a workaround? My initial thoughts were the date is pulled from the users computer clock, and if they have this setup in american format as opposed to English it would display this error. However in changing around my system clock (Windows 7) I'm unable to replicate the issue.
Thanks for any advice!
Dan.
Discussion (4)
Strangely, in preview mode the CurrentDate variable shows as May 16, 2014. When published it shows as 5/16/2014. They should at least let you pick the format. I would think if it were to default to anything, it should display the full date as any real certificate should. Shorthand 5/16/2014 seems unprofessional.
Lectoras html output is using the javascript function "toLocaleDateString()" to format the date in the way it is common at the users' location. That function seems to be known to not work properly with all combinations of operating systems and browsers. As Lectora preview mode doesn't support javascript a different format for the date is used.
Tim
If you will email me directly, I can give point you to a JavaScript solution to formatting dates.
If you want consistency, you'll need to use your own script to construct a uniform string that represents the date. Lectora relies on user's browser to provide that info and it's inconsistent.
Discussions have been disabled for this post