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

feat: Added property to choose default render month/year #383

Merged
merged 4 commits into from
Jun 6, 2023

Conversation

cyiafn
Copy link
Contributor

@cyiafn cyiafn commented Jun 6, 2023

Problem

The RangeCalendar and Calendar does not allow users to select which month/year to render by default and defaults to Today.

Use case is for querying past data, in which the user might save a click for this kind of scenarios.

This is backwards compatible.

Closes #375

Solution

Allow users to pass in an optional prop to set the default render date.

Before & After Screenshots

BEFORE:
image

AFTER:
Set to 2005-05-01
image

Tests

  1. Test that onchange DT works as intended for both RangeCal and Cal.
  2. Test that visual navigation including selection works correctly.

@cyiafn cyiafn requested a review from karrui June 6, 2023 07:04
@netlify
Copy link

netlify bot commented Jun 6, 2023

Deploy Preview for objective-bell-0ffbfb canceled.

Name Link
🔨 Latest commit dcb1c67
🔍 Latest deploy log https://app.netlify.com/sites/objective-bell-0ffbfb/deploys/647ef05c2f87b10008478445

@cyiafn cyiafn force-pushed the feat/default-cal-render-my branch from 9aa2c17 to b9e4c02 Compare June 6, 2023 07:06
react/src/Calendar/CalendarBase/CalendarContext.tsx Outdated Show resolved Hide resolved
react/src/Calendar/Calendar.tsx Outdated Show resolved Hide resolved
react/src/Calendar/RangeCalendar.tsx Outdated Show resolved Hide resolved
@karrui
Copy link
Collaborator

karrui commented Jun 6, 2023

Also please do add stories for regression snapshot testing~

Copy link
Collaborator

@karrui karrui left a comment

Choose a reason for hiding this comment

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

sorry, one last round of changes it seems :P

react/src/DatePicker/DatePickerContext.tsx Outdated Show resolved Hide resolved
react/src/DatePicker/DatePickerContext.tsx Outdated Show resolved Hide resolved
react/src/DatePicker/DatePickerContext.tsx Outdated Show resolved Hide resolved
react/src/Calendar/Calendar.stories.tsx Show resolved Hide resolved
react/src/DatePicker/DatePicker.stories.tsx Outdated Show resolved Hide resolved
@cyiafn cyiafn force-pushed the feat/default-cal-render-my branch from 4e8dc49 to 91f0968 Compare June 6, 2023 08:24
Copy link
Collaborator

@karrui karrui left a comment

Choose a reason for hiding this comment

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

lgtm

@cyiafn cyiafn merged commit a476f06 into main Jun 6, 2023
@cyiafn cyiafn deleted the feat/default-cal-render-my branch June 6, 2023 08:44
@karrui karrui mentioned this pull request Jun 6, 2023
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.

Calendar does not allow customisation of initial month
2 participants