Overview
You have noticed that the live chat window uses a 24-hour (military) format for displaying the time on each message, and would like to change that to use a 12-hour format.
Solution
By default, Kayako uses the 24-hour format for the chat messages and there isn't a setting to configure this. Nevertheless, note that it is possible to modify this by updating the source code.
Note that for this process it is necessary to have access to the server with the Kayako installation folder, and Admin access to the Kayako instance.
- Go to the <kayako_install_folder>/__apps/livechat/javascript/visitor/thirdparty/legacy folder.
- Save a copy of the livesupport.js file as a backup.
- Open the livesupport.js file in the text/code editor of your preference and search for the RetrieveTimeStamp() function (around line 395)
- Modify the existing code in the function with the following code. The bolded lines are the ones that are modified.
function RetrieveTimestamp() {
_timeStampText = '';
if (_swiftDisplayTimestamps == '1')
{
var _currentTimeStamp = new Date();
var _currentMinutes = _currentTimeStamp.getMinutes();
var _currentHours = _currentTimeStamp.getHours();
var _ampm = _currentHours >= 12 ? 'PM' : 'AM';
if (_currentMinutes < 10) {
_currentMinutes = '0' + _currentMinutes;
}
if (_currentHours < 10) {
_currentHours = '0' + _currentHours;
}
_currentHours = _currentHours % 12;
_currentHours = _currentHours ? _currentHours : 12; // the hour '0' should be '12'
_timeStampText = '<span class="timestamp">' + _currentHours + ':' + _currentMinutes + ' ' + _ampm + '</span>';
}
return _timeStampText;
} - Save the file changes.
- Go into the Kayako Admin CP > Diagnostics and click Rebuild cache.
- You can also Rebuild the Helpdesk Cache Manually.
- Clear the browser's cache in order to download the new version of the JS file.
Alternatively, you can also find attached to this article a JS file that has already been updated to use the 12-hour format. This file has been tested to work with version 4.93.29 and it is likely to work with other versions, but it is recommended to always test it beforehand.
If you choose to use this file, then steps 3-5 from the solution can be skipped as you would instead use the attached livesupport.js file to replace the one on your Kayako installation.
Note that any customization done directly on the source files would be overwritten whenever the Kayako Classic application is upgraded/reinstalled as this would replace all installation files. Thus, in such scenarios, one would need to apply the code changes again.
Testing
Once the file is updated and the cache is cleared, the chat window will use the 12-hour format for the messages.