BootsFaces-OSP
BootsFaces-OSP copied to clipboard
Two datetimepicker with minDate
Hello, I use 2 DateTimePicker to select interval of time (start and end). I force the minDate and maxDate of both using other widget information. The start date is mandatory and the end not.
My issue is when I select a date in the future with the start date, a date appears in the end and cannot be remove. The end date should not be forced.
<b:column col-sm="12">
<b:dateTimePicker required="true" id="dateDebut" value="#{bean.dateDebut}"
format="DD/MM/YYYY" maxDate="#{of:formatDate(bean.dateFin, 'MM/dd/yyyy')}"
ondtchange="ajax:true" process="@this" update="dateFin" label="Start">
<f:validateRequired/>
</b:dateTimePicker>
<b:message for="dateDebut" styleClass="fieldError"/>
</b:column>
<b:column col-sm="12">
<b:dateTimePicker id="dateFin" value="#{bean.dateFin}" required="false" format="DD/MM/YYYY"
minDate="#{of:formatDate(bean.dateDebut, 'MM/dd/yyyy')}" label="End"/>
<b:message for="dateFin" styleClass="fieldError"/>
</b:column>
Is it a bug or a bad use? Bootfaces 1.5.0 but it was the same with 1.4.2
I take a look into the update response - only the value of 'minDate' has changed - so I think it is a behavior of the js datetimepicker - can you reproduce the error in a vanilla js project? Then you can open an issue the github project of the js datetimepicker or make a pull request there
https://eonasdan.github.io/bootstrap-datetimepicker/Options/#minmaxdate
Notes the use of xmlns: of = "http://omnifaces.org/functions" is very advisable here and could be listed as a tip in the showcase. The standard AJAX behavior is not so perfect here, the use of ondtchange = "ajax: ***" leads to the desired behavior and could also be noted in the showcase as a tip
Sorry but I not at all a JS dev, so I don't know how to do.
On https://getdatepicker.com/4/#linked-pickers (the example seems partially the same), the error doesn't happen. However, the version 4 is an old version and I'm not sure it is maintained.
I'm afraid development of BootsFaces has slowed down considerably. We'll never manage to address this issue. Let's close it.