Hello!
I have such a task: the user can reserve an asset for himself. The start date must not be earlier than the current date. If I set the futureOrPresent validation for the “Start Date”, the Cuba issues the following warning: the date must be later than or equal to the current date. As I understand it, when I select 10/25/2022 a date comes with a time of 00:00:00, which is less than the current date, which has a time up to a second.
So far, I managed to solve the problem as follows: I enter the current date variable and cut off the time on it. It turns out this is the code:
@Subscribe(target = Target.PARENT_CONTROLLER)
public void onBeforeShow(Screen.BeforeShowEvent event) {
Date currentDate = DateUtils.truncate(new Date(), Calendar.DAY_OF_MONTH);
dateToField.setRangeStart(dateFromField.getRangeStart());
dateFromField.setValue(currentDate);
dateFromField.setRangeStart(currentDate);
He works. But I’m wondering if it is possible to do the same, but using the platform itself?