how to set date in date picker as per the year and date [Resolved]

Posted by Manorama under ASP.NET MVC on 11/10/2016 | Points: 10 | Views : 1595 | Status : [Member] | Replies : 1
hi to all,
I am using boostrap date picker.Here iam unable to findout the solution for my issue,the thing is:i have to set renewal date as :2017/july/10;If system date is 2017jan10th boostrap date picker shows same date as 2017july10th,once system date is crossed 2017july10th boostrap datepicker automatically update its time to 2018july10.how to set smart date range.please guide me.
thank you in advance.

ManoRama


Responses

Posted by: Rajnilari2015 on: 11/10/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
Try this

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.2.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker3.css">
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>
<script type='text/javascript'>
$(window).load(function(){
$('#divTestDtPicker input').datepicker({
autoclose: true
});

$('#divTestDtPicker input').on('show', function(e){
console.debug('show', e.date, $(this).data('stickyDate'));

if ( e.date ) {
$(this).data('stickyDate', e.date);
}
else {
$(this).data('stickyDate', null);
}
});

$('#divTestDtPicker input').on('hide', function(e){
console.debug('hide', e.date, $(this).data('stickyDate'));
var stickyDate = $(this).data('stickyDate');

if ( !e.date && stickyDate ) {
console.debug('restore stickyDate', stickyDate);
$(this).datepicker('setDate', stickyDate);
$(this).data('stickyDate', null);
}
});
});
</script>

</head>
<body>
<div id="divTestDtPicker">
<input type="text" type="text" class="form-control" />
</div>
</body>
</html>


--
Thanks & Regards,
RNA Team

Manorama, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response