Kendoui higri datepicker - asp.net-mvc

As per the link and the code given below you can see that I defined the culture for the date picker to be ar-SA which is the Hijri date.
You can see that it is getting the wrong today date and year. How can I fix this>
It should get 1435 but it gets 2013 in the footer and the initial date.
http://jsfiddle.net/zvjWe/786/
kendo.culture("ar-SA");
$("#datepicker").kendoDatePicker({
format:"d/M/yyyy",
min:new Date(1300,0,1)
});

Related

Disabling the previous date based on current date using angular material

I found this snippet to disable the previous dates
<md-datepicker
ng-model="myDate"
md-placeholder="Enter date"
md-min-date="minDate"
md-max-date="maxDate"></md-datepicker>
but instead of entering the minDate i want to assign the system date.
pls do help
Asign to minDate the value of today like this
var minDate = new Date();

datePicker showing one day previous wrong day in grails

In edit and print (html print) mode, I have get one day previous date. I have used mysql database. My domain like
class Immunization {
------
Date doseOneDue
Date doseOneGiven
----
}
I have use datepicker in view like
<g:datePicker name="doseOneDue" precision="day" noSelection="['': '']"
value="${immunizationInstance?.doseOneDue}"
relativeYears="[-5..5]" default="none"/>
Now problem is:
suppose doseOneDue is '2015-08-30', But when I showing it in datePicker in edit mode then it is selecting '29 - 08 - 2015', Also in html print option showing also one day less. How can handle this problem.

Datebox - get the event and validate year, month, and date by entering a value manually

I am using datebox plugin for jquery mobile http://dev.jtsage.com/jQM-DateBox2/unit/datebox.html
Everything works fine.
Here my question is how do i validating the individual year, month, date input fields by entering the numeric values in the specific fields ((ie) keydown/keypress..) without using of plus and minus buttons.
Thanks in advance...
This function checks if the input changed and logs the new date into the console.log:
$("div.ui-grid-b div input.ui-input-text").change(function() {
var parent = $(this).parent().parent();
console.log("date changed to: "
+parent.find("div.ui-block-a input.ui-input-text").val()+":"
+parent.find("div.ui-block-b input.ui-input-text").val()+":"
+parent.find("div.ui-block-c input.ui-input-text").val()
);
});

jQuery UI datepicker - minDate and setDate issue

I have a strange issue with the jQuery UI datepicker. This is the questionable code:
$('#cal').datepicker();
d = new Date('07/05/2013');
$('#cal').datepicker('option','minDate',d);
d.setDate(10);
$('#cal').datepicker('setDate',d);
This should set the min date to July 5 and the selected date to July 10. However, both the min date and the selected date are being set to July 10. Why is this? jsbin demo
Note: I know I can get around this by creating two date objects, but I want to understand why this happens.
You're updating the same object 'd'. So you're setting both dates to the same object which is set to 10.
You should instead do something like:
$('#cal').datepicker('option','minDate', new Date('07/05/2013'));
$('#cal').datepicker('setDate', new Date('07/10/2013'));

jQuery datepicker set selected date, on the fly

How can I change the selected date of jquery Date picker dynamically on the fly?
I have say created a inline date picker.
Then after some time, I want to reflect a different date there without recreating the datepicker from the scratch.
I tried the setDate method, but did not work, and there is not much documentation in the doc.
There is another (extended?) plugin here, but I want to use the plugin which is shipped with jquery.ui.all.js.
What version of jQuery-UI are you using? I've tested the following with 1.6r6, 1.7 and 1.7.1 and it works:
//Set DatePicker to October 3, 2008
$('#dateselector').datepicker("setDate", new Date(2008,9,03) );
Check that the date you are trying to set it to lies within the allowed date range if the minDate or maxDate options are set.
This example shows of how to use default value in the dropdown calendar and value in the text box. It also shows how to set default value to previous date.
selectedDate is another variable that holds current selected date of the calendar control
var date = new Date();
date.setDate(date.getDate() - 1);
$("#datepicker").datepicker({
dateFormat: "yy-mm-dd",
defaultDate: date,
onSelect: function () {
selectedDate = $.datepicker.formatDate("yy-mm-dd", $(this).datepicker('getDate'));
}
});
$("#datepicker").datepicker("setDate", date);
Noted that for DatePicker by Keith Wood (http://keith-wood.name/datepickRef.html) the following works - note that the setting of the default date is last:
$('#datepicker').datepick({
minDate: 0,
maxDate: '+145D',
multiSelect: 7,
renderer: $.datepick.themeRollerRenderer,
***defaultDate: new Date('1 January 2008')***
});
$('.date-pick').datePicker().val(new Date()).trigger('change')
finally, that what i look for the last few hours! I need initiate changes, not just setup date in text field!
For some reason, in some cases I couldn't make the setDate work.
A workaround I found is to simply update the value attribute of the given input.
Of course the datepicker itself won't be updated but if what you just look for is to display the date, it works fine.
var date = new Date(2008,9,3);
$("#your-input").val(date.getMonth()+"/"+date.getDate()+"/"+date.getFullYear());
// Will display 9/3/2008 in your #your-input input
This is a old thread but I just want to give some information how I have used. If you want to set today date you can simply apply it like below.
$("#datepickerid").datepicker("setDate", "0");
If you want to set some days before/after the current date then use the symbol -/+ symbol of how many days you want like below.
$("#datepickerid").datepicker("setDate", "-7");
$("#datepickerid").datepicker("setDate", "+5");
This works for me:
$("#dateselector").datepicker("option", "defaultDate", new Date(2008,9,3));
please Find below one it helps me a lot to set data function
$('#datepicker').datepicker({dateFormat: 'yy-mm-dd'}).datepicker('setDate', '2010-07-25');
setDate only seems to be an issue with an inline datepicker used in jquery UI, the specific error is InternalError: too much recursion.
In Html you can add your input field with a date picker like this
<input class="form-control date-picker fromDates" id="myDate" type="text">
and then in java script, initialize your datepicker and set your value to the date like this,
$('.fromDates').datepicker({
maxDate: '0',
dateFormat: "dd/mm/yy",
changeYear: true,
changeMonth: true,
yearRange: "-100:+0"
});
var myDateVal = moment('${value}').format('DD/MM/YYYY');
$('#myDate').datepicker().datepicker('setDate', myDateVal );
(In here fromdate attribute shows the previous dates of the current date)
var dt = new Date();
var renewal = moment(dt).add(1,'year').format('YYYY-MM-DD');
// moment().add(number, period)
// moment().subtract(number, period)
// period : year, days, hours, months, week...
I had a lot of trouble with the setDate method as well. seems to only work in v1. What does seem to work however is using the dpSetSelected method:
$("#dateselector").dpSetSelected(new Date(2010, 0, 26).asString());
good luck!
or you can simply have
$('.date-pick').datePicker().val(new Date()).trigger('change')

Resources