formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Minimum and maximum date change every time the Day component is updated

Open nicola88 opened this issue 1 year ago • 5 comments

If you set the Maximum Day and/or Minimum Day fields under the Validation tab of a Day component, every time you change any component settings the maxDate and minDate fields are updated with the current values minus one or two days.

The behavior was originally observed with formiojs v4.21.4

screen-capture

How to reproduce

  1. Create a new form, for example using the Form Builder
  2. Add a Day component to the form
  3. Open the Validation tab and set the Maximum Day and Minimum Day fields with any combination of dates
  4. Save settings
  5. Open again the component settings and click on Save, without changing anything
  6. Check the values of the component maxDate and minDate in the form schema and the values should be different than before

Expected behavior

The original values should not updated automatically.

nicola88 avatar Jan 02 '25 12:01 nicola88

Maybe the problem could be here:

https://github.com/formio/formio.js/blob/7cbee3bbb379b137d920b6365d30510db7edc64d/src/components/day/Day.js#L63

There's some misleading between date and conversion with moment and isoString

valesceva avatar Jan 14 '25 10:01 valesceva

@nicola88 Thank you for reporting this issue. I am able to reproduce it and have logged a ticket for the backlog. We are always willing to review any contributions to resolve this issue from the open-source community.

For internal reference: FIO-9614

olgabann avatar Jan 15 '25 14:01 olgabann

We may have time to look into it soon, in case it is ok if we try to find the fix for the v4.21.4 so we can avoid upgrading to a new major version?

nicola88 avatar Apr 04 '25 14:04 nicola88

@nicola88 We are always happy to review any contributions made to our open source!

lane-formio avatar Apr 04 '25 16:04 lane-formio

@lane-formio @olgabann Hi, I would like to try fixing the bug for the v4, is there a guide on how to develop and some guideline?

valesceva avatar May 19 '25 12:05 valesceva