I try like this :
var lastMonth = new Date();
lastMonth.setMonth(lastMonth.getMonth() - 1 );
$('#datetimepicker').datetimepicker({
defaultDate: lastMonth
});
It works
But in the datetimepicker bootstrap plugin, whether there are methods that can be used?
$('#datetimepicker').datetimepicker({
defaultDate: moment(12, "MM");
});
This line of code will set the current year and last month by default:
moment(3, "MM");
Also make sure you have momentjs
library referenced.