Skip to content

New functionality to adjust day when changing week, month or year #1123

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

Merged
merged 7 commits into from
Dec 16, 2017

Conversation

forum-is
Copy link
Contributor

@forum-is forum-is commented Nov 6, 2017

We propose the following added functionality to improve the user experience for the datepicker component.

If the new property adjustDateOnChange is set to true, the date will automatically change when the current month is altered via the arrow controls or a different year is selected via the year dropdown. Also, all changes through keyboard shortcuts are supported. If adjustDateOnChange is undefined or false, the behaviour is unchanged from the current release versions.

The following example illustrates the new behaviour:

  • current date is 2017-10-31 (October 31st, 2017)
  • the month is changed to November by pressing the right arrow symbol inside the datepicker
  • the date will automatically adjust to 2017-11-30 (nearest possible date in the following month)

The same methodology applies if the year is changed.

Prop 'adjustDateOnChange' offers a possibility to update the date
respectively on month switch or year select. Keyboard support.
@codecov
Copy link

codecov bot commented Dec 5, 2017

Codecov Report

Merging #1123 into master will decrease coverage by 1.02%.
The diff coverage is 55.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1123      +/-   ##
==========================================
- Coverage   86.25%   85.22%   -1.03%     
==========================================
  Files          13       13              
  Lines         851      873      +22     
  Branches      142      148       +6     
==========================================
+ Hits          734      744      +10     
- Misses         32       40       +8     
- Partials       85       89       +4
Impacted Files Coverage Δ
src/calendar.jsx 83.96% <100%> (-0.29%) ⬇️
src/year_dropdown.jsx 76% <36.36%> (-15.9%) ⬇️
src/index.jsx 89.52% <50%> (-0.8%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1fc705...5775ca1. Read the comment docs.

@martijnrusschen
Copy link
Member

Can you add some tests to cover your new behaviour? We want to avoid breaking this behaviour next time someone touches this code.

@martijnrusschen martijnrusschen merged commit de12087 into Hacker0x01:master Dec 16, 2017
Squar89 pushed a commit to Squar89/react-datepicker2 that referenced this pull request Apr 10, 2019
…cker0x01#1123)

* Change date on month switch and year select

* Change date on month switch and year select

Prop 'adjustDateOnChange' offers a possibility to update the date
respectively on month switch or year select. Keyboard support.

* Error corrections.

* Added tests for 'adjustDateOnChange'

* Bugfix
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.

2 participants