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

Fix "Submission input type date doesn't work properly once a value has been set" #2593

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

alisaismailati
Copy link
Contributor

References

Description

There have been changes on DsDatePickerComponent and NumberPickerComponent affecting the maxYear value, because the issue was caused by the restriction set by maxYear value on DsDatePickerComponent. update() method in NumberPickerComponent is fixed in order to emit the changes when the value is greater than the maxValue. This change triggers the form validations.

Instructions for Reviewers

List of changes in this PR:

  • First, maxYear variable should not get its value by initialYear ( because for eg. in our case the initialYear's value is 23), but it should consider now.getUTCFullYear() and start from the actual year (+ 100 , existing part).
    But in case it is entered a greater value than now.getUTCFullYear() + 100 , the behavior with leaving the input empty will be triggered again.
  • So, in order to trigger the validations of the form, the update() method of NumberPickerComponent is fixed in order to emit the changes when the value is greater than the maxValue (it emits undefined in this case). This way the user will make sure to enter a valid value.

steps to reproduce the bug are the same as described on #2588
Result:
https://github.com/DSpace/dspace-angular/assets/126179045/97984ce5-cdc7-42e9-9719-bcaa8a7db7f1

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

alisaismailati and others added 2 commits October 30, 2023 11:31
[DSC-106] Date input usable via keyboard using tab

Approved-by: Vincenzo Mecca
@tdonohue tdonohue added bug component: submission 1 APPROVAL pull request only requires a single approval to merge port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release labels Oct 30, 2023
@tdonohue tdonohue changed the title Duracom 194 Fix "Submission input type date doesn't work properly once a value has been set" Oct 30, 2023
@tdonohue tdonohue requested review from tdonohue and artlowel November 2, 2023 15:50
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

👍 Thanks @alisaismailati ! This works perfectly. I was able to reproduce the issue easily on our demo site. Then I was able to verify that this code fixes the behavior and that both tab and shift+tab move properly between the year/month/day fields. Code and tests look good too!

@tdonohue tdonohue merged commit e62832f into DSpace:main Nov 3, 2023
10 checks passed
@tdonohue tdonohue added this to the 8.0 milestone Nov 3, 2023
@dspace-bot
Copy link
Contributor

@tdonohue tdonohue removed the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug component: submission
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Submission input type date doesn't work properly once a value has been set
3 participants