How to change view mode in bootstrap datepicker like yyyy-mm?

How to change view mode in bootstrap datepicker like yyyy-mm?

In this post we will give you information about How to change view mode in bootstrap datepicker like yyyy-mm?. Hear we will give you detail about How to change view mode in bootstrap datepicker like yyyy-mm?And how to use it also give you demo for it if it is necessary.

When i was working on my laravel application and i need use datepicker picker but i require only select year and month because i have to filter with onlt selected month and year. I did search lot and also check options of datepicker js but i can’t do it that because i was wrong maybe.

But at last found minViewMode option of datepicker library and i did that if you also want to make format like mm-yyyy or yyyy-mm then you can set minviewmode this way :

Example:

<html lang="en">

<head>

<title>Bootstrap - datepicker change view mode like yyyy-mm</title>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">

<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>

</head>

<body>


<div >

<h2>Bootstrap - datepicker change view mode like yyyy-mm</h2>

<input style="width: 300px;" type="text">


<script type="text/javascript">

$('.date-own').datepicker({

minViewMode: 1,

format: 'yyyy-mm'

});

</script>

</div>


</body>

</html>

Hope this code and post will helped you for implement How to change view mode in bootstrap datepicker like yyyy-mm?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

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

7  +  3  =  

We accept paid advance and paid guest Posting on our Site : Contact US