0

I have this input that I am using for dates.

<input id="txtsdate" class="form-control" type="text">
<script>
$('#txtsdate').data('datepicker').setStartDate(new Date(TimezoneDate()));
$('#txtsdate').data('datepicker').setEndDate(Infinity);
$('#txtsdate').data('datepicker').setDate(sFulllDate);
</script>

until this point my code works well and i set normally the date. But when i try to get the date from the input and i am using

var sDate = $('#txtsdate').data('datepicker').getDate();

am getting 'Invalid Date'. I have read this article https://github.com/uxsolutions/bootstrap-datepicker/issues/923 but doesn't seems to help me.

focus
  • 171
  • 9
  • 31
  • 1
    Please provide a **runnable** [mcve] – charlietfl Nov 20 '17 at 13:38
  • possible duplicate https://stackoverflow.com/questions/27285458/jquery-ui-datepicker-and-mvc-view-model-type-datetime – Kixoka Nov 20 '17 at 13:40
  • @Kixoka i am not duplicate... If you read the article you mention it says "date 16/12/2014 will give me the error while 12/12/2014 won't" . i am not facing this issue, also not describing this issue... – focus Nov 20 '17 at 14:04

1 Answers1

1

Try This Simply code to get input value of any text box using jquery

var sDate = $("#txtsdate").val();
M.Y.Mnu
  • 718
  • 8
  • 22