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-picker): check properties on first render of calendar #18019

Merged

Conversation

annawen1
Copy link
Member

@annawen1 annawen1 commented Nov 7, 2024

Closes #18018

Properties applied to the date-picker that don't have default values aren't applied to on the first render and are only checked in the updated cycle. Hence why it works in storybook when the properties are applied once the date-picker has been rendered.

Changelog

Changed

  • add _setCalendar() function that sets the calendar
  • add checks for properties in the _instantiateDatePicker() that will call _setCalendar() and apply them on the first render
  • use _setCalendar() in the updated() cycle that checks for changedProperties

Testing / Reviewing

run storyook locally and apply the properties (open, min-date, etc) directly in the playground story code in date-picker.stories.ts and see if they are applied when date-picker first renders

example:

<cds-date-picker
        ?disabled="${disabled}"
        date-format="${dateFormat}"
        ?readonly="${readonly}"
        min-date="11/09/2024" <----- set a value here
        max-date="11/23/2024" <----- set a value here and see if calendar applies this range on first render

Copy link

netlify bot commented Nov 7, 2024

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit ad24e25
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/672d210030c5640008c148ba
😎 Deploy Preview https://deploy-preview-18019--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 7, 2024

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit ad24e25
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/672d2100952f7a0008c71a69
😎 Deploy Preview https://deploy-preview-18019--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Nov 7, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit ad24e25
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/672d2100952f7a0008c71a67
😎 Deploy Preview https://deploy-preview-18019--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.81%. Comparing base (62877c2) to head (ad24e25).
Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18019   +/-   ##
=======================================
  Coverage   81.81%   81.81%           
=======================================
  Files         404      404           
  Lines       14085    14085           
  Branches     4409     4380   -29     
=======================================
  Hits        11523    11523           
+ Misses       2400     2399    -1     
- Partials      162      163    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@ariellalgilmore ariellalgilmore left a comment

Choose a reason for hiding this comment

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

LGTM! noticing a weird thing though that the year gets unbolded when i put the min and max locally
Screenshot 2024-11-08 at 10 23 02 AM

@annawen1
Copy link
Member Author

annawen1 commented Nov 11, 2024

LGTM! noticing a weird thing though that the year gets unbolded when i put the min and max locally Screenshot 2024-11-08 at 10 23 02 AM

Ah! I think this might be intended - if I set the max and min date to be a year apart (ie. 11/12/2024 - 11/12/2025), the year is bolded because there is a little year adjuster that appears when you hover over the year. I guess if the dates are within the same year, that functionality gets disabled and the year is unbolded.
Screenshot 2024-11-11 at 2 04 58 PM

Copy link
Member

@kennylam kennylam left a comment

Choose a reason for hiding this comment

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

LGTM!

@annawen1 annawen1 added this pull request to the merge queue Nov 11, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 11, 2024
@annawen1 annawen1 added this pull request to the merge queue Nov 11, 2024
@annawen1 annawen1 removed this pull request from the merge queue due to a manual request Nov 11, 2024
@annawen1 annawen1 added this pull request to the merge queue Nov 11, 2024
Merged via the queue into carbon-design-system:main with commit 8713091 Nov 11, 2024
40 checks passed
@annawen1 annawen1 deleted the fix/date-picker-first-render branch November 11, 2024 20:47
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.

[Bug]: date-picker inputting min and max date range doesn't work
3 participants