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

FIO-8798: updated day component validation #140

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

Maria-Golomb
Copy link
Contributor

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-8798

Description

Day component validation was changed.
The changes were caused by a change in the formation of the data string for the Day component with hidden fields.
if a element of the day component is hidden, it should be excluded from the string instead of populating with ‘00’

Examples (new years): 

day / year == ‘01/2024’

month / year = ‘01/2024’

day / month = ‘01/01’

Breaking Changes / Backwards Compatibility

How has this PR been tested?

autotests

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

Copy link
Contributor

@johnformio johnformio left a comment

Choose a reason for hiding this comment

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

just small nit regarding type casting. Otherwise LGTM

month = values[MONTH],
year = values[YEAR],
maxDay = getDaysInMonthCount(month, year);
let [DAY, MONTH, YEAR] = (component as DayComponent).dayFirst ? [0, 1, 2] : [1, 0, 2];
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the isDayComponent type guard so you don't have to cast component everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@TanyaGashtold TanyaGashtold merged commit 630bc96 into master Aug 26, 2024
8 checks passed
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.

3 participants