jQWidgets Forums
Forum Replies Created
Viewing 3 posts - 1 through 3 (of 3 total)
-
Author
-
February 6, 2017 at 12:56 pm in reply to: Two jqxDateTimeInputs Date() values?? Two jqxDateTimeInputs Date() values?? #91315
Seems to be an issue in Chrome, I’m running latest version (56.0.2924.87 – 64- bit) on Windows 7.
Works as expected in Internet Explorer V11February 6, 2017 at 12:34 pm in reply to: Two jqxDateTimeInputs Date() values?? Two jqxDateTimeInputs Date() values?? #91312Here is a simple version of my code
<div class="form-horizontal"> <div class="row"> <div class="col-sm-2">Start Date:</div> <div class="col-sm-2"><div id="startDate"></div></div> <div class="col-sm-2">End Date:</div> <div class="col-sm-2"><div id="endDate"></div></div></div> <table> <thead> <tr><th></th><th>.val()</th><th>.val('date')</th></tr> </thead> <tbody> <tr> <td>StartDate</td> <td><input id="stVal"/></td> <td><input id="stValDate"/></td> </tr> <tr> <td>EndDate</td> <td><input id="endVal"/></td> <td><input id="endValDate"/></td> </tr> </tbody> </table> <br/> <div class="row"> <button id="grabDates" type="button">Grab Dates</button> </div> </div>
and the js
<script type="text/javascript"> $(document) .ready(function() { $("#startDate").jqxDateTimeInput({ width: 160, height: 30 }); $("#endDate").jqxDateTimeInput({ width: 160, height: 30 }); var stDate = new Date(); var endDate = new Date(); endDate.setDate(28); $("#startDate").jqxDateTimeInput('setDate', stDate); $("#endDate").jqxDateTimeInput('setDate', endDate); $("#grabDates") .click(function () { var stVal = $("#startDate").val(); $('#stVal').val(stVal); var stValDate = $("#startDate").jqxDateTimeInput('getDate'); $("#stValDate").val(stValDate); var endVal = $("#endDate").val(); $('#endVal').val(endVal); var endValDate = $("#endDate").jqxDateTimeInput('getDate'); $("#endValDate").val(endValDate); }); }); </script>
Try it, you’ll see that the value in the .val(‘date’) column is always the same, and is always the date time from whichever of the two date time input fields was clicked last.
February 6, 2017 at 9:36 am in reply to: Two jqxDateTimeInputs Date() values?? Two jqxDateTimeInputs Date() values?? #91301You have missed the key point, the text in the start date field is 01/02/2017 i.e. 1st Feb 2017 but the value returned by $(“#startDate”).val(‘date’) is 1st March 2017.
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)