My xhtml:
Code: Select all
<p:calendar pattern="yyyy-MM-dd HH:mm" mode="inline" value="#{obj.dateFrom}"/>
Thanks
Code: Select all
<p:calendar pattern="yyyy-MM-dd HH:mm" mode="inline" value="#{obj.dateFrom}"/>
Use a f:convertDateTime tag instead of the pattern attribute.jina_lu wrote:I want to use inline calendar, but getting "- dashboardForm:j_id1090828255_301fd875_1: '2013-04-24' could not be understood as a date and time. Example: 2013-04-24 10:27 ". Anyone had solved such problem before?
My xhtml:dateFrome is java.util.Date variable.Code: Select all
<p:calendar pattern="yyyy-MM-dd HH:mm" mode="inline" value="#{obj.dateFrom}"/>
Thanks
Please refer to the User Guide and the Showcase, especially the Time Picker examples.jina_lu wrote:I tried the andyba suggested way. In this case user won't have possibility to chose specific time.
Looks like a bug of "inline" mode ignoring time as components works fine in standard mode. Any other ideas?
For an analogy to illustrate my point.jina_lu wrote:I should disagree with you andyba that calendar is only for date.
DateTime in http://www.primefaces.org/showcase/ui/calendarTime.jsf showcase shows exactly the usage I'm taking about.
Without "inline" mode calendar deals with date and time selection with no problem. Are you saying that "inline" mode doesn't support such behavior?
Code: Select all
Index: src/main/resources/META-INF/resources/primefaces/calendar/calendar.js
===================================================================
--- src/main/resources/META-INF/resources/primefaces/calendar/calendar.js (revision 12491)
+++ src/main/resources/META-INF/resources/primefaces/calendar/calendar.js (working copy)
@@ -33,6 +33,14 @@
//Setup timepicker
var hasTimePicker = this.hasTimePicker();
if(hasTimePicker) {
+ // parse f.defaultDate into cfg.hour/minute/second
+ if (cfg.defaultDate) {
+ // remove the date from the format and default value, parse the results
+ // and extend the config with the parse results
+ var timeFormat = cfg.dateFormat.substring(cfg.dateFormat.indexOf(' ') + 1);
+ var defaultTime = cfg.defaultDate.substring(cfg.defaultDate.indexOf(' ') + 1);
+ $.extend(cfg, $.datepicker.parseTime(timeFormat, defaultTime));
+ }
this.configureTimePicker();
}
@@ -130,8 +138,13 @@
_self.fireDateSelectEvent();
}
else {
- var newDate = $.datepicker.formatDate(_self.cfg.dateFormat, _self.getDate());
+ // probably better to find timepicker object and use formattedDateTime/Time values
+ var newDate = _self.cfg.timeOnly ? "" : $.datepicker.formatDate(_self.cfg.dateFormat, _self.getDate());
+ if (_self.cfg.timeFormat) {
+ newDate += " " + _self.jqEl.find('.ui_tpicker_time')[0].innerText;
+ }
+
_self.input.val(newDate);
_self.fireDateSelectEvent();
}
@@ -233,4 +246,4 @@
return false;
}
-});
\ No newline at end of file
+});
Users browsing this forum: No registered users and 36 guests