0

I am using bootstrap date-picker on HTML form

<script>

$(document).ready(function() {

    $('.datepicker').datepicker({
        autoclose: true,

    });


});

Now i have two date fields on my form called start-date and end-date. I want to set start-date to be the 1st day of the month and end -date to be the last date of the month . Is it possible to set it on Bootstrap date-picker ? sample code will be appreciated.

amphetamachine
  • 27,620
  • 12
  • 60
  • 72
BipinSasi
  • 187
  • 14
  • what have you tried? please mention your code here. You want the datepickers to be fixed on 1st & last days of every month? – Rohit Batra Jan 02 '15 at 10:58

1 Answers1

0
var dateToday = new Date();
 var fromDate = (dateToday.getMonth() + 1) + "/01/" +    dateToday.getFullYear()
 var toDate = (dateToday.getMonth() + 1) + "/" + dateToday.getDate() + "/" + dateToday.getFullYear()

see more of my answer here. JQuery DatePicker on ASP.net

or this

var month = 0; // January
var d = new Date(2008, month + 1, 0);
alert(d); // last day in January

from Calculate last day of month in javascript

Community
  • 1
  • 1
agentpx
  • 1,051
  • 1
  • 8
  • 24