在原始日历timepicker中的bug? [英] bug in primefaces calendar timepicker?

查看:151
本文介绍了在原始日历timepicker中的bug?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有此时间选择器日历:

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"/>

当我设置模式:dd-MM-yyyy没有时间一切都正确添加,我改为:dd-MM-yyyy HH:mm我得到这个错误:

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'不能理解为日期和时间。

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.

我有primefaces_v4.jar。我查看此面 http://forum.primefaces.org/viewtopic.php ?f = 3& t = 22982 但我找不到任何解决方案

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

编辑:
像所有依赖模式 atribute的 p:calendar 。如果我有默认弹出模式一切都很好(像在 http://primefaces.org/showcase/ui/calendarTime.jsf 但是当我改为内联模式时,我得到这个错误:
cal:inlineCal: '13 -04-2014'无法理解为日期和时间。示例:13-04-2014 15:16

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

推荐答案

PrimeFaces默认使用SimpleDateFormat,除非你重写formatter。
http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

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

EDIT
如果你改变你的心态属性与你的模式一样,你的模式将工作。
IE:你不能有一个模式dd -MM-yyyy HH:mm当你有一个mindate =01/09/2013​​
改变你的心态到 - 01-09-2013

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
在调试一个公平的位置是正确的,似乎有一个错误,在javascript中设置inputValue字段之前发送到服务器,甚至使用模式转换器...

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...

我得到它所有工作重新编译代码与以下更改:
在calendar.js行129(被合并到primefaces.js) var newDate = this.value;

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;

基本上现在它试图对输入做一个formatDate,这是很好的导致其相同的日期格式分裂,即dd / mm / yy等..但它完全跳过'时间'附加不能使用parseDatetime,因为它做一个整个对象时间,这应该在你只是建立对象的java一方。

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是你想要的,无论是在post中发送回来,这是它对_self.cfg.popup的作用(它甚至不设置输入...
我会在PF上引发一个问题

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

提出问题6790上的 PrimeFaces问题跟踪器

这篇关于在原始日历timepicker中的bug?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆