Only replace T in value if datetime-local is not supported.

According to my tests, this is what makes datetime-local fail in
browsers which already support it. Replacing the T in the value is
required to set the date/time in browsers which don't support it,
but it somehow throws off the (re)setting in browsers which do.

So using Modernizr's feature test to check if the replacement is
required should solve the issue. However, this seems strange, we
should keep an eye on it.
This commit is contained in:
Matthias Mees 2013-10-05 10:46:50 +02:00
parent 82b2f2f8fe
commit 0c80e7afaf

View File

@ -752,13 +752,17 @@ var AccessifyHTML5 = function (defaults, more_fixes) {
// Make the timestamp readable in browser not supporting datetime-local.
// Has no effect in those supporting it, as the timestamp is invalid in HTML5
if($('body').has('#serendipityEntry').size() > 0) {
$('#serendipityNewTimestamp').val($('#serendipityNewTimestamp').val().replace("T", " "));
if(!Modernizr.inputtypes.date) {
$('#serendipityNewTimestamp').val($('#serendipityNewTimestamp').val().replace("T", " "));
}
}
// Set entry timestamp
$('#reset_timestamp').click(function(e) {
$('#serendipityNewTimestamp').val($(this).attr('data-currtime'));
$('#serendipityNewTimestamp').val($('#serendipityNewTimestamp').val().replace("T", " "));
if(!Modernizr.inputtypes.date) {
$('#serendipityNewTimestamp').val($('#serendipityNewTimestamp').val().replace("T", " "));
}
e.preventDefault();
});