Closed icodebuster closed 7 years ago
initialDate
is the date initially selected when the calendar popup first shows. To prefill a date in the textbox, simply set the input's value (see example jsbin).
Wouldn't it be nice to have it as an option rather than playing with the text box itself? Everything at one place.
You could always use set date
if you didn't want to play with the input.
Yes, that did it.
This is what I did
$('#date-of-membership').calendar({
type: 'date',
today: true,
maxDate: new Date(),
formatter: {
date: function (date, settings) {
if (!date) return '';
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
return day + '/' + month + '/' + year;
}
},
}, 'set date', new Date());
Thank you 👍
@mdehoog
set date
is not working in 0.0.8 can you confirm that. The set date
was working which I had used previously refer above. Also, how can I check if updateInput = true, fireChange = true
is working for set date.
I am working with vue.js and when I change the date it's not getting updated, reason, being change event is not getting triggered.
If possible please update it in JSBin with set date
example.
Thank you.
'set date' works fine on 0.0.8. and the latest Semantic-UI framework. This issue is probably due to initial value is null or date is invalid. If you are using a framework other than Jquery, make sure the values are not null when you creating the calendar object. For e.g. in Aurelia, you need to set @observable for initialDate variable then call 'set date' Also if you are using moment date object, try formatting it. E.g. 'DD-MM-YYYY'
From your example, in JSBin the
initialDate
option should set today's date in the textbox, but it's not working as expected.I want to show today date prefilled in the textbox and also enable user to select dates.