1
votes

I have this calendar with time picker on my page:

 <p:calendar value="#{addTaskBacking.currentTask.deadline}" mode="inline" 
  pattern="dd-MM-yyyy HH:mm" mindate="01-09-2013 00:00"/>

When I set the pattern: dd-MM-yyyy without the time everything is added correctly, but when I change to: dd-MM-yyyy HH:mm I get this error:

j_idt10:j_idt12: '9-04-2014' could not be understood as a date and time.

This is when I set the inline mode, when I set the popup is all ok.

I have primefaces_v4.jar. I check this side http://forum.primefaces.org/viewtopic.php?f=3&t=22982 but i can't find any solution

Edit: It look like all depends of mode atribute of p:calendar. If i have default popup mode everything it's fine (like in example on http://primefaces.org/showcase/ui/calendarTime.jsf. But when I change to inline mode i get this error: cal:inlineCal: '13-04-2014' could not be understood as a date and time. Example: 13-04-2014 15:16

1

1 Answers

2
votes

PrimeFaces uses SimpleDateFormat by default unless you override the formatter. http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

EDIT Your pattern will work if you change your mindate attribute to be the same as your pattern.. IE: You can't have a pattern dd-MM-yyyy HH:mm when you have a mindate="01/09/2013" Change your mindate to - 01-09-2013

EDIT 2 AFter debugging a fair bit you're right, there seems to be a bug when setting the inputValue field in javascript prior to being sent in the POST to the server to even use the pattern converters...

I got it all working recompiling the code with the following changes: Line 129 in calendar.js (gets merged into primefaces.js) var newDate = this.value;

Basically at the moment it tries to do a formatDate on the input which is fine cause its the same date format split ie, dd/mm/yy etc.. but it totally skips 'time' being attached can't use parseDatetime as it does an entire object time, which should be don eon the java side as you just build the object.

this.value is what you want regardless to be sent back in the post which is what it does for _self.cfg.popup (it doesn't even set the input val because its already there!... I'll raise an issue with PF

"Raised Issue 6790 on the PrimeFaces Issue Tracker"