Creating Bootstrap datepicker

View

<form>

<input type=”text” id=”pickADate” data-bind=”value: dataModel().pickADate” class=”datepicker form-control” readonly name=”pickADate”​ />

<!– id, name can be anything. class is important –>

<script>require[”…., “bootstrap-datepicker”, “bootstrap-datepickerGB”​], function(….,datepicker, datePickerGb) {

                    moment.locale(“en-gb”); // Set Locale for moment (aka moment.locale(“en-gb”))
var vm.mydateDate = moment(data.MyDateDate).format(“L”); // we get dd/mm/yyyy

$(‘.datepicker’).datepicker({ language: “en-GB” });​

}

## requirejs config

        “bootstrap-datepicker”: “bootstrap-datepicker”,
        “bootstrap-datepickerGB”: “locales/bootstrap-datepicker.en-GB.min”,

Thats all..

Leave a Reply

Your email address will not be published. Required fields are marked *