Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OF#3755] Datetime validation #636

Merged
merged 3 commits into from
Jan 24, 2024
Merged

Conversation

SilviaAmAm
Copy link
Contributor

Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (42b47c4) 73.04% compared to head (eb4def7) 73.74%.
Report is 16 commits behind head on main.

Files Patch % Lines
src/formio/validators/utils.js 84.00% 1 Missing and 3 partials ⚠️
src/formio/components/DateTimeField.js 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #636      +/-   ##
==========================================
+ Coverage   73.04%   73.74%   +0.69%     
==========================================
  Files         219      220       +1     
  Lines        4474     4498      +24     
  Branches     1186     1192       +6     
==========================================
+ Hits         3268     3317      +49     
+ Misses       1167     1142      -25     
  Partials       39       39              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SilviaAmAm SilviaAmAm force-pushed the fix/3755-datetime-validation branch from ca98e41 to 8a6bf59 Compare January 18, 2024 14:20
@SilviaAmAm SilviaAmAm changed the title [#3755] Datetime validation [OF#3755] Datetime validation Jan 18, 2024
@SilviaAmAm SilviaAmAm marked this pull request as draft January 18, 2024 15:15
If the datetime is entered with the keyboard instead of the widget, no validation was being performed. This adds the validation in the same way as for the date component (see open-formulieren/open-forms#3443)
@SilviaAmAm SilviaAmAm force-pushed the fix/3755-datetime-validation branch from 8a6bf59 to 25589d3 Compare January 19, 2024 09:50
@SilviaAmAm SilviaAmAm marked this pull request as ready for review January 19, 2024 10:02
return {isValid: true};
}

const parsedValue = parseISO(value, 'yyyy-MM-dd', new Date());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the format be dependent on the componentType too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually doesn't seem to be used 🤔 parseIso does not have a format argument 🤔 https://date-fns.org/v2.3.0/docs/parseISO#arguments
I will remove these extra args

src/jstests/formio/components/datetime.spec.js Outdated Show resolved Hide resolved
@SilviaAmAm SilviaAmAm force-pushed the fix/3755-datetime-validation branch from 434d7f6 to eb4def7 Compare January 22, 2024 15:10
Copy link
Member

@sergei-maertens sergei-maertens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to merge this after the 2.5.0 release, we can then release it as a bugfix for 2.5.1.

@sergei-maertens sergei-maertens merged commit 646aa8c into main Jan 24, 2024
15 checks passed
@sergei-maertens sergei-maertens deleted the fix/3755-datetime-validation branch January 24, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Form builder - Datetime field empties itself when a invalid date is entered
3 participants