Foros de discusión

Does input-date interpret firstDayOfWeek wrong?

Julian Pfeil, modificado hace 7 años.

Does input-date interpret firstDayOfWeek wrong?

Junior Member Mensajes: 72 Fecha de incorporación: 1/03/16 Mensajes recientes
I just used a liferay-ui:input-date field for a dater picker and found some weird behaviour - at least i think so...

When using the following JSP-script...
<liferay-ui:input-date name="project-start" firstDayOfWeek="<%= [b]Calendar.MONDAY [/b]%>" />
<liferay-ui:input-date name="project-end" firstDayOfWeek="<%= [b]Calendar.SUNDAY[/b] %>" />


... you can see in the screenshots, that the left calendar (Calendar.MONDAY) starts on tuesday and the right calender (Calendar.SUNDAY) starts on monday.
Is it possible that liferay thinks, that the days start at 0? Because actually they start at 1 (Sunday). 2 Is Monday and so forth... (See java.util.Calendar).

Is this a bug(then i put it into the feedback forum) or am i mistaken here?

Archivos adjuntos:

thumbnail
ANKIT SRIVASTAVA, modificado hace 7 años.

RE: Does input-date interpret firstDayOfWeek wrong?

Junior Member Mensajes: 76 Fecha de incorporación: 2/02/11 Mensajes recientes
I see, being used as :

firstDayOfWeek="<%= cal.getFirstDayOfWeek() - 1 %>"

https://github.com/liferay/liferay-portal/blob/master/portal-web/docroot/html/taglib/ui/input_field/page.jsp

Thanks,
Ankit
Julian Pfeil, modificado hace 7 años.

RE: Does input-date interpret firstDayOfWeek wrong?

Junior Member Mensajes: 72 Fecha de incorporación: 1/03/16 Mensajes recientes
ANKIT SRIVASTAVA:
I see, being used as :

firstDayOfWeek="<%= cal.getFirstDayOfWeek() - 1 %>"

https://github.com/liferay/liferay-portal/blob/master/portal-web/docroot/html/taglib/ui/input_field/page.jsp

Thanks,
Ankit


But what if i want to set the first day of week to a specific day?... Then i have to use e.g. firstDayOfWeek="<%= Calendar.Tuesday - 1 %>", which is absurd and defys basic programming principles, which is quite funny, because in the docs Liferay is always praised as so intuitive and easy to use...