datePicker showing one day previous wrong day in grails - 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.

Related

Date-picker date format and datepicker options

i have a few problems with the date-picker, especially regard the date format.
I need to make a date-format like that 'ddMMyyyy' without symbols like slash or minus.
this is my Markup
HTML
<input type="text" datepicker-popup="{{format}}" show-weeks="false" ng-model="Fromdate" show-button-bar='false'>
and that's my format in javascript
JS
$scope.format='ddMMyyyy';
is this the right way to make the format?
Because if i choose the date from the datepicker nothing seems to go wrong but if i type directly the text a errors happens.
the first four number were evaluated like year, so if i type '01022014' i aspect first february 2014 instead the date-picker evaluate 14 of no month (20 is not a month) of the 0102 year.
Second question, i'd like to put the option of the date Picker in the js file and not in the markup, for example:
HTML
<input type="text" datepicker-popup="{{format}}" ng-model="Fromdate" datepicker-options="options">
js
$scope.options={
show-weeks:"false"
show-button-bar:'false'
}
but in that way it seems doesn't work, what is thee right way to do that?
Use Uib-Datepicker
Js:
$scope.dateOptions = {
showWeeks: false,
format: 'ddMMyyyy'
};
HTML:
<uib-datepicker ng-model="selectedDate" datepicker-options="dateOptions" ng-required="true"></uib-datepicker>

Kendoui higri datepicker

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)
});

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 year change when select month, IE7

Our project using JSF1.2, Icefaces 1.8.2, jQuery UI component datepicker (veresion 1.8.14). Problem with IE7 (Firefox is fine). Problem will happen with following sequence: Select a date (for example, couple days befor doday). Note we have set year range from 1991 to 2012. Our business logic is print a document use that date (in code, called dateOfStudy) as title, once done, in the JSF back bean, I clear the calendar inputext date field to null. Now click datepicker icon again, the year corrtly shows 2011, select any previous month (for example go back to Auguest, 2011), problme happend right here: the year will change to 1991, can not keep at 2011.
The problem will not happen if I do not touch that date field (don't do clear, keep the old date). The problem will still appear even I just change the date font to other color via CSS (seems whenever I touch that field, datepicker will messed up). The problem will not happen if you click today once, or close datepicker, open again.
Seems the datepick need some initializtion after I cleared date?
I attached some code. I have trid method/option like setDate, onChangeMonthYear, beforShowDay, can not solve. Any help is appreciated !!
<script type="text/javascript">
var jq = jQuery.noConflict();
jq(document).ready(function() {
jq("[id$=fmv]").live('click', function() {
jq(this).datepicker( {
showOn : 'focus',
changeMonth : true,
changeYear : true,
dateFormat : 'mm/dd/yy',
yearRange : '-20:+1',
showButtonPanel : true,
closeText : 'Close'
}).focus();
});
});
</script>
<ice:inputText id="fmv"
style="background-image:url ('../../../jquery/images/calendar1.png');
background-repeat:no-repeat;background-position:right;"
value="#{pItem.dateOfStudy}"
validator="#{pItem.validate}"
partialSubmit="true"
name="fmv"
valueChangeListener="#{pItem.dateChangeListener}">
</ice:inputText>
When backbean clear or change input text in calendar inputText, I think that causes a focus event, and calendar confused under IE7. The reason I am using showOn focus is the code is in a table AJAX display area, so use calendar show on image button not work since the button image will not show when AJAX update comes back (the jQuery calendar will not get called), which force me to use showOn focus. I finally solved this year change problem by adding the following refresh calendar line after the final .focus():
jq(this).datepicker("setDate",jq("[id$=fmv]").datepicker("getDate"));
things working fine now. I am not sure how to make this call only when backbean clean the calendar date, but performance seems ok.

Resources