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(Date): update date range / break of year #1358

Closed
1 task done
Feamusbal opened this issue Mar 19, 2024 · 5 comments · Fixed by #1364
Closed
1 task done

🐛 fix(Date): update date range / break of year #1358

Feamusbal opened this issue Mar 19, 2024 · 5 comments · Fixed by #1364
Assignees
Labels
🐛 bug Something isn't working

Comments

@Feamusbal
Copy link

Current Behavior

If only entering two digits for the year (e.g., 12.12.60) the Date component auto completes the first two digits for the year. The break of year changes to 20XX until the 60s (e.g. 12.12.60 becomes-> 12.12.2060). This does not match the users expected mental model as they are more likely to enter 1960 than 2060)

Expected Behavior

For numbers between 35->99 we should use 19XX format. The lower number should update every year (next year 36-99).
For numbers between 00->34 we should use 20XX format. The high number should update every year (next year 00-35).

Break of Year should be added as a properity to the component.

Steps to Reproduce

see above

Version

v15

Browsers

No response

Device

No response

Code Reproduction URL

No response

Additional Information

I entered it as a bug as it isn't a feature

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Feamusbal Feamusbal added the 🐛 bug Something isn't working label Mar 19, 2024
@hirsch88
Copy link
Member

/cib

@hirsch88 hirsch88 self-assigned this Mar 25, 2024
Copy link
Contributor

Branch fix/issue-1358 created!

@hirsch88
Copy link
Member

@Feamusbal this change can only be done globally and not per use case

@hirsch88
Copy link
Member

  public static setTwoDigitCutoffYear(cutoff = 10) {
    Settings.twoDigitCutoffYear = ((new Date()).getFullYear() % 100) + cutoff
  }

I can do this so today plus 10 years in the future is possible for 2000 rest will be 1900. So the cutoff year will be now 2034 and 35 will be 1935.

@Feamusbal
Copy link
Author

@hirsch88 will it be easy to update it over time? So that next year (2025) it will be 35->2035 and 36-> 1936?

hirsch88 added a commit that referenced this issue Mar 26, 2024
* Create PR for #1358

* fix(date): adjust cutoff year

* fix input date test

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gery Hirschfeld <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants