指定值“2018-04-01T00:00:00.000Z”不符合所需格式“yyyy-MM-dd”
我找到了在启动选项中格式化How to create a Minimal, Complete, and Verifiable example日期的位置,但现在我的日期选择器消失了。
```
<script>
$(document).ready(() => {
$(".button-collapse").sideNav();
$('.datepicker').datepicker('yyyy-MM-dd');
});
</script>
```
..因为他们都调用className .datepicker,我想知道Materialise&amp; JQuery导致冲突
<div className = "input-field" >
<input type="date" class="datepicker" date = {this.state.date_planted} name = "date_planted" ref = "date_planted" value = {this.state.date_planted} onChange = {this.handleInputChange} />
<label htmlFor = "date_planted" ></label>
</div>
<div className = "input-field" >
<input type="text" className="datepicker" date = {this.state.date_last_checked} name = "date_last_checked" ref = "date_last_checked" value = {this.state.date_last_checked} onChange = {this.handleInputChange} />
<label htmlFor = "date_last_checked" ></label>
</div>
如果我将输入类型更改为文本,则会预填充正确的日期,但我的日期选择器不可用。 如果我将输入类型保留为日期,则它会预先填写“ mm / dd / yyyy ”,因为它没有可供参考的信息。
Materialize
https://github.com/TurtleWolf/Food_Liberation_Front
https://food-liberation-front.herokuapp.com