javascript - Bootstrap 3 Datepicker v4 - Can't set date to values between 0 and 14400000 -


i'm using working javascript ui includes bootstrap 3 datepicker v4. data uses '0' special flag gets assigned ui. i'm finding trying set value of field 0 not working, , on further investigation, stretches point works @ 14400000 not @ 13999999. doing wrong, or can differently set value 0?

html:

<h1>demo</h1> <form class="form-group" onsubmit="return false;">   <div class="form-group">     <label for="enddate">end date</label>       <div class='input-group date' id='enddate'>         <input type='text' class="form-control" />         <span class="input-group-addon">           <span class="glyphicon glyphicon-calendar"></span>         </span>     </div>   </div>   <button id="zerobutton">set zero</button>   <button id="grossbutton">set gross</button>   <button id="grosslessbutton">set grossless</button>   <button id="todaybutton">set today</button>    </button>   </button> </form> 

js:

$(document).ready( function() {     $("#enddate").datetimepicker();    $("#zerobutton").click(function() {     // set jan 1, 1970     $("#enddate").data("datetimepicker").date(new date(0));   });   $("#grossbutton").click(function() {     // set jan 1, 1970     $("#enddate").data("datetimepicker").date(new date(14400000));   });   $("#grosslessbutton").click(function() {     // set jan 1, 1970     $("#enddate").data("datetimepicker").date(new date(14399999));   });   $("#todaybutton").click(function() {     // set jan 1, 1970     $("#enddate").data("datetimepicker").date(new date());   }); }); 

check out working version on jsfiddle.

the bootstrap 3 datetimepicker uses moment library. pass in moment object instead of date object:

  $("#zerobutton").click(function() {     // set jan 1, 1970     $("#enddate").data("datetimepicker").date(moment(0));   }); 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -