cisco-sbg-ui / atomic-react

https://atomic-react.security.cisco.com
2 stars 5 forks source link

fix: min and max date picker range issues #1172

Closed brennarvo closed 2 years ago

brennarvo commented 2 years ago

Please check if the PR fulfills these requirements

What kind of change does this PR introduce?

Fixes the issue of all the days in the month being disabled inside an ADatePicker with a range restriction.

What is the current behavior?

The calculation for the min and max date is assuming that the first date picker selection is in the current month.

minDate = new Date()
maxDate = new Date()

What is the new behavior (if this is a feature change)?

Initialized both the min and max date instances with the first date selection to serve as a base for the calculations.

minDate = new Date(firstDateSelection)
maxDate = new Date(firstDateSelection)
vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/securex/atomic-react/Cwu2hveaAidV9kEwfVhYZqLugoep
✅ Preview: https://atomic-react-git-fix-date-picker-range-securex.vercel.app

codecov[bot] commented 2 years ago

Codecov Report

Merging #1172 (d749fb5) into master (419fc4f) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1172   +/-   ##
=======================================
  Coverage   90.14%   90.14%           
=======================================
  Files          97       97           
  Lines        2973     2973           
  Branches     1032     1032           
=======================================
  Hits         2680     2680           
  Misses        250      250           
  Partials       43       43           
Impacted Files Coverage Δ
framework/components/ADatePicker/useADateRange.js 100.00% <100.00%> (ø)

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 419fc4f...d749fb5. Read the comment docs.