I am attempting to dynamically set the options for this datetimepicker plugin.
This is what I have in my controller
$(document).ready(function () {
var today = moment(new Date()).format("YYYY-MM-DD");
var tomorrow = moment().add(1, 'days');
$scope.datetimepickerOptions = {
format: "YYYY-MM-DD",
defaultDate: today // need to set today or tomorrow here
};
});
and this is my HTML
// Today's date option should be placed here
<input datetimepicker
datetimepicker-options="{{datetimepickerOptions}}"/>
// Tomorrow's date option should be situated here
<input datetimepicker
datetimepicker-options="{{datetimepickerOptions}}"/>
These options are used to set the initial values of the inputs/fields. In the first input, I want to display today's date for the user, and in the second input, it should show tomorrow's date.
What would you suggest?
EDIT
I tried doing it like this
$scope.datetimepickerOptions = {
todayOptions: {
format: "YYYY-MM-DD",
defaultDate: today
},
tomorrowOptions: {
format: "YYYY-MM-DD",
defaultDate: tomorrow
}
};
However, I encountered the following error
TypeError: option todayOptions is not recognized!