Created
December 18, 2018 07:17
-
-
Save surferxo3/651623ed4c4990c811627836ec484f5f to your computer and use it in GitHub Desktop.
Enable specific dates in bootstrap datepicker widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Create case: you want to enable only the future dates and disable the past | |
Update case: you still want to enable future dates but enable only the the past date already stored in the db | |
*/ | |
var now = moment(moment().format('DD/MM/YYYY'), 'DD/MM/YYYY'); | |
$('#bulk-sms-form #start_date').datepicker({ | |
format: 'dd/mm/yyyy', | |
beforeShowDay: function(date) { | |
var current = moment(date); | |
return current.isSame(moment('{{$messageConfig->start_date}}')) || current.isSameOrAfter(now); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment