I have an input to which I have assigned a datetimepicker() so that it can display dates.
$('.fecha').datetimepicker({ 'locale': 'es'});
I would like to know if there is any option of the datetimepicker which allows me to set as a minimum date to choose 1 month before the current one, that is, if we are in February, then it allows me to choose the dates of January but not those of December, nor dates before December
The method is
minDate
to put the minimum date. Now with what you say "1 month before", it can be done withmoment().subtract(1, 'months')
, it would look like this:References
Try this:
Gets the month and subtracts one for the previous month, and from day 1.