I currently have 2 datepickers.
First is StartDate & other is EndDate
On selecting StartDate after clicking on calender i want EndDate's Datetimepicker to be shown & not show/display earlier dates.
Currently i got this:
<script>
jQuery('.input-daterange').datepicker({ startDate:'+1', format: 'dd-mm-yyyy'});
$('#StartDate , #EndDate').on('changeDate', function(ev){
$(this).datepicker('hide');
});
</script>
Related
In my screen the Kendo UI Calendar used behaves odd.
When i come on to editing the screen and click on Calendar field if the date is past date (disabled on calendar) then the existing date value gets cleared, even though i am not making any change.
How can i persist the date value for the past dates that are disabled in the calendar.
It would be helpful to give sample code for the fix.
The same we tried with HTML calendar and JQuery Calendar and the behavior is same as of Kendo UI Calendar.
The code used is in javascript
$('#txtWFITaskStartDate').change(function (e) {
e.preventDefault();
e.stopImmediatePropagation();
var labelName = $(this).data('validatelabel');
var CurrentId = $(this).attr('id');
var startDate = $("#" + CurrentId).val();
var duration = $('#txtWFITaskDuration').val();
if ($('#' + CurrentId).val() === "") {
varErrorClassName = 'errmsgStartDate';
DisableTaskEditControls();
$('#StartDate').after('<span class="text-danger ' + varErrorClassName + '">' + Web_IsRequired.replace("{0}", labelName) + '</span>');
}
else {
$('.errmsgStartDate').remove();
$('.errmsgEndDate').remove();
EnableTaskEditControls();
var endDate = CalculateEndDate(duration, startDate);
$('#txtWFITaskEndDate').val(endDate);
$('#EndDate').datepicker('setDate', new Date(endDate));
endDate = $('#txtWFITaskEndDate').val();
if (endDate !== "") {
EnableTaskEditControls();
} else {
varErrorClassName = 'errmsgEndDate';
$('#EndDate').after('<span class="text-danger ' + varErrorClassName + '">' + Web_IsRequired.replace("{0}", "End date") + '</span>');
DisableTaskEditControls();
}
}
});
Below is the screenshot of the dates displayed on modal popup view (MVC)
As the Start Date is past date the control displays in disabled mode. When focus to the Start Date control and focus out from it. The past date gets cleared. I want to hold the existing value, until user changes the date else the same value has to persist in the Start date text box.
I am new to Ionic2.
Is there any way to display showing current date in ionic2 of datepicker ?? I mean current date won't show before datepicker's pick.It will only show only when datepicker apears. Thanks in advance.
Try mapping the datepicker model to a variable which holds the current date:
<ion-datetime [(ngModel)]="currentDate" /></ion-datetime
and in your controller:
var currentDate = new Date();
here's an example :
https://codesundar.com/ionic2-tutorial/ionic-2-date-picker-example/
<ion-datetime (ionChange)="changeDate()" displayFormat="MMMM YYYY" pickerFormat="MMMM YYYY" [(ngModel)]="filterdate"></ion-datetime>
and in your ts file
filterdate = this.today.toISOString();
Requirements - End date must be equal and greater then start selected start date in boostrap datepicker and before selected start date disable.
Problem - its possible in jquery date but I want to know how to make in boostrap date.
my boostrap code is
$('#start_date').datepicker({autoclose: true,startDate: new Date()});
$('#end_date').datepicker({autoclose: true,startDate: new Date()});
for reference check jquery code
Fiddle
Note - I want exact implemention of this picker in bootstrap
Can anyone help me?
Please check out this JSFiddle demo. I have placed the code below that uses bootstrap datepicker.
$(".from_date").datepicker({
format: 'yyyy-mm-dd',
autoclose: true,
}).on('changeDate', function (selected) {
var startDate = new Date(selected.date.valueOf());
$('.to_date').datepicker('setStartDate', startDate);
}).on('clearDate', function (selected) {
$('.to_date').datepicker('setStartDate', null);
});
$(".to_date").datepicker({
format: 'yyyy-mm-dd',
autoclose: true,
}).on('changeDate', function (selected) {
var endDate = new Date(selected.date.valueOf());
$('.from_date').datepicker('setEndDate', endDate);
}).on('clearDate', function (selected) {
$('.from_date').datepicker('setEndDate', null);
});
I have a date picker using jquery. However I want to add the 'bounce' animation to it. Please help me adding this animation to the date picker. My code as of now is:
$(function() {
$("#datepicker").datepicker({ dateFormat: "DD, d MM, yy" });
});
Is this what you are trying to accomplish?
$(function() {
$("#datepicker").datepicker({ showAnim: "bounce", dateFormat: "DD, d MM, yy" });
});
http://jsfiddle.net/damyanpetev/VS2hV/
Additionally you can set duration and additional options that correspond to the effect you are using (in this case 'bounce' .
I am trying to initialize a Kendo "datepicker" with the following options:
$("#elementid").kendoDatePicker({
//...
depth: "year"
});
When I change month in the widget I would like to set in my view model the last day of the selected month (not, as by default, the first one).
For instance: by selecting "January" the datepicker is set on "01/01/2013", but I would like it to return "31/01/2013" (the last day).
Does somebody know how can i do it?
Define you kendoDatePicker as:
$("#elementid").kendoDatePicker({
...
depth : "year",
change: function (e) {
var val = this.value();
this.value(new Date(val.setMonth(val.getMonth() + 1, 0)));
}
});
We handle the change event and use JavaScript for calculating the last day of the chosen date.