admin管理员组文章数量:1406924
I am trying implement Bulma calendar in my project and I have a difficult setting a default start date.
I am doing the following as per documentation.
<input type="date" data-start-date="10/24/2019">
The date shows up fine when the date picker is open:
However, it does not show up in the input to begin with:
Minimum boilerplate is here: Codepen
I am trying implement Bulma calendar in my project and I have a difficult setting a default start date.
I am doing the following as per documentation.
<input type="date" data-start-date="10/24/2019">
The date shows up fine when the date picker is open:
However, it does not show up in the input to begin with:
Minimum boilerplate is here: Codepen
Share Improve this question asked Oct 24, 2019 at 11:59 JacobdoJacobdo 2,0333 gold badges24 silver badges42 bronze badges2 Answers
Reset to default 4Try it like this:
HTML:
<input type="date" />
JS:
// Initialize all input of type date
var calendars = bulmaCalendar.attach('[type="date"]', {startDate: new Date('10/24/2019')});
// Loop on each calendar initialized
for(var i = 0; i < calendars.length; i++) {
// Add listener to date:selected event
calendars[i].on('select', date => {
console.log(date);
});
}
// To access to bulmaCalendar instance of an element
var element = document.querySelector('#my-element');
if (element) {
// bulmaCalendar instance is available as element.bulmaCalendar
element.bulmaCalendar.on('select', function(datepicker) {
console.log(datepicker.data.value());
});
}
Use the "value" attribute, e.g. date today Feb.26, 2021
<input type="date" value="2021-02-26">
本文标签: javascriptBulma calendar date input does not show the prepopulated start dateStack Overflow
版权声明:本文标题:javascript - Bulma calendar date input does not show the pre-populated start date - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744972360a2635310.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论