Liferay date-input displays wrong date

与世无争的帅哥 提交于 2019-12-06 15:32:34

The problem is the month value. In Java it's 1-12 with liferay datepicker it's 0-11. In order to display the correct month i subtracted 1 from month value. It's not an elegant solution but i couldn't find any better way.

<liferay-ui:input-date
    dayValue="<%= today.getDayOfMonth()%>"
    monthValue="<%=today.getMonth().getValue() - 1 %>"
    yearValue="<%= today.getYear()%>"
</liferay-ui:input-date>

This will render 12/03/2018

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!