BootsFaces-OSP icon indicating copy to clipboard operation
BootsFaces-OSP copied to clipboard

Two datetimepicker with minDate

Open bvedrenne opened this issue 4 years ago • 4 comments

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

bvedrenne avatar Aug 14 '20 12:08 bvedrenne

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

geopossachs avatar Aug 16 '20 08:08 geopossachs

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

geopossachs avatar Aug 16 '20 08:08 geopossachs

Sorry but I not at all a JS dev, so I don't know how to do.

bvedrenne avatar Aug 18 '20 07:08 bvedrenne

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.

bvedrenne avatar Feb 21 '22 15:02 bvedrenne

I'm afraid development of BootsFaces has slowed down considerably. We'll never manage to address this issue. Let's close it.

stephanrauh avatar Aug 12 '24 15:08 stephanrauh