Use jQuery.datepicker date formatting instead of own code

This commit is contained in:
Michal Čihař 2013-07-08 11:15:40 +02:00
parent c906cccb1a
commit bd69fe5b66

View File

@ -751,24 +751,13 @@ function savePrefsToLocalStorage(form)
function updatePrefsDate()
{
var d = new Date(window.localStorage['config_mtime_local']);
var msg = PMA_messages.strSavedOn.replace('@DATE@', formatDate(d));
var msg = PMA_messages.strSavedOn.replace(
'@DATE@',
$.datepicker.formatDate('yy-mm-dd', d) + ' ' + $.datepicker.formatTime('HH:mm', d)
);
$('#opts_import_local_storage div.localStorage-exists').html(msg);
}
/**
* Returns date formatted as YYYY-MM-DD HH:II
*
* @param {Date} d
*/
function formatDate(d)
{
return d.getFullYear() + '-' +
(d.getMonth() < 10 ? '0' + d.getMonth() : d.getMonth()) +
'-' + (d.getDate() < 10 ? '0' + d.getDate() : d.getDate()) +
' ' + (d.getHours() < 10 ? '0' + d.getHours() : d.getHours()) +
':' + (d.getMinutes() < 10 ? '0' + d.getMinutes() : d.getMinutes());
}
/**
* Prepares message which informs that localStorage preferences are available and can be imported
*/