datetime-local fallback and fix timestamp-button

This commit is contained in:
onli 2013-06-16 15:56:35 +02:00
parent 325d3be574
commit 06f65b44b3
2 changed files with 7 additions and 1 deletions

View File

@ -25,7 +25,7 @@
<label for="serendipityNewTimestamp">{$CONST.DATE}</label>
<input id="serendipityNewTimestamp" name="serendipity[new_timestamp]" type="datetime-local" value="{$entry_vars.timestamp|@formatTime:'o-m-d\TH:i':true:false:true}">
<a id="reset_timestamp" class="button_link" href="#serendipityNewTimestamp" data-currtime="{$entry_vars.reset_timestamp|@formatTime:DATE_FORMAT_2:true:false:true}" title="{$CONST.RESET_DATE_DESC}"><span class="icon-clock"></span><span class="visuallyhidden"> {$CONST.RESET_DATE}</span></a>
<a id="reset_timestamp" class="button_link" href="#serendipityNewTimestamp" data-currtime="{$entry_vars.reset_timestamp|@formatTime:'o-m-d\TH:i':true:false:true}" title="{$CONST.RESET_DATE_DESC}"><span class="icon-clock"></span><span class="visuallyhidden"> {$CONST.RESET_DATE}</span></a>
</div>
{/if}
<div id="edit_entry_category" class="form_select">

View File

@ -674,9 +674,15 @@ function highlightComment(id, checkvalue) {
e.preventDefault();
});
// Make the timestamp readable in browser not supporting datetime-local.
// Has no effect in those supporting it, as the timestamp is invalid in HTML5
$('#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", " "));
e.preventDefault();
});