我不能为我的生活得到格式的日期...在我愤怒删除我的“有趣”项目之前,有人可以帮忙吗? :)
console.log(date)
几乎是完美的,显示:2018-06-28T23:00:00.000Z
而input
字段值更新为value="Fri Jun 29 2018 00:00:00 GMT+0100 (GMT Summer Time)"
。
我不明白为什么console.log(e.date)
会展示一件事,.val(e.date)
会展示一些完全不同的东西?
任何帮助将不胜感激,我已经阅读了15个网站并尝试了几十种不同的配置。谢谢。
$(function() {
$('#next_review_date').datepicker({
format: 'dd/mm/yy',
weekStart: 1,
startDate: '+1d',
maxViewMode: 2,
clearBtn: true,
daysOfWeekHighlighted: "1,2,3,4,5",
todayHighlight: true
}).on('changeDate', function(e) {
console.log(e.date);
$('#selected_next_review_date').val(e.date);
});
});
<div id="next_review_date"></div>
<input type="hidden" name="next_review_date" id="selected_next_review_date" value="" />
在metronic上已有的datepicker。我的例子:
<div class="m-portlet__body">
<form class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed">
<div class="m-portlet__body">
<div class="form-group m-form__group row">
<div class="col-lg-12">
<input type="text" class="form-control" id="m_datepicker_1" readonly="" placeholder="date" data-date-format="dd.mm.yyyy">
</div>
</div>
</div>
</form>