Monday, August 21, 2017

Working with MVC5 and bootstrap DateTimePicker (eonasdan)


Issue:



Install-Package Bootstrap.v3.Datetimepicker.CSS



bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/bootstrap-datetimepicker.min.js",
                      "~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootstrap.css",
                      "~/Content/bootstrap-datetimepicker.min.css",
                      "~/Content/site.css"));


<script type="text/javascript">
    $('#DateTest').datetimepicker(
        {
   //v3 turn off the time selector
            format: 'DD-MMM-YYYY'
            //pickDate: true                 //en/disables the date picker
           // pickTime: false,                 //en/disables the time picker
            //useMinutes: false,              //en/disables the minutes picker
           // useSeconds: false,              //en/disables the seconds picker
          //  startDate: moment().subtract('days', 1)// a minimum date

        });
</script>


Source:


https://blog.jigsawpieces.me/2014/07/23/lbd-adding-datetimepicker-control-to-mvc-project/
http://eonasdan.github.io/bootstrap-datetimepicker/Options/

No comments:

Post a Comment