简体   繁体   中英

action or actionListener not fired when using pattern “hh:mm a” in Prime faces calendar p:calendar

I need to use prime faces calendar to fill time ONLY as the following :

<h:body>
   <h:form>
      <p:calendar pattern="hh:mm a" value="#{bean.startTime}"/>
      <p:commandButton value="Save" actionListener="#{bean.saveAppointment}" />
    </h:form>
</h:body>

But the saveAppointment method not fired at all. and without any Exception.

After tracing the issue I have concluded that the issue from the date conversion that primefaces uses under the cover.That is because when I omit a from the pattern ie(the pattern become pattern="hh:mm" ). Then the action fired normally without any issue.

Note Primefaces version is 6

我通过使用pattern="HH:mm"找到了一个解决方法,大写H将使小时数为0-23。

检查选项:timeOnly =“true”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM