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: add year month selector to calendar component #1663

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alaa-yahia
Copy link
Member

@alaa-yahia alaa-yahia commented Feb 10, 2025

Implements LIBS-726

Other PR: dhis2/multi-calendar-dates#84

Desc

  • add month & year drop downs to easily be able to jump to a year/ month without navigating using prev/next buttons.
  • add pastOnly prop to display past years only (starting from current year)
image

Checklist

  • API docs are generated
  • Tests were added
  • Storybook demos were added

@dhis2-bot
Copy link
Contributor

dhis2-bot commented Feb 10, 2025

🚀 Deployed on https://pr-1663--dhis2-ui.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify February 10, 2025 21:04 Inactive
@@ -38,6 +38,7 @@ export const CalendarInput = ({
strictValidation,
inputWidth,
dataTest = 'dhis2-uiwidgets-calendar-inputfield',
pastOnly,
Copy link
Collaborator

Choose a reason for hiding this comment

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

as a general approach - shouldn't this just be controlled by minDate / maxDate from the client? The client should set the max date (we have a helper that gets the current date in the specified calendar) .. it will then avoid having hardcoded number of years that seems tracker-specific right now

Copy link
Member Author

@alaa-yahia alaa-yahia Feb 18, 2025

Choose a reason for hiding this comment

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

The minDate and maxDate validation parameters are not being passed through to the calendar component. Also, the useDatePicker hook is not utilizing these validation parameters because the validateDateString function is being called directly within the calendar input component.
There is already another issue to disable out of range dates I think it would be better to keep it this way for now.

@dhis2-bot dhis2-bot temporarily deployed to netlify February 18, 2025 07:23 Inactive
@cooper-joe cooper-joe self-requested a review February 19, 2025 08:24
@cooper-joe
Copy link
Member

Design changes from review are included in this PR

@dhis2-bot dhis2-bot temporarily deployed to netlify February 28, 2025 08:54 Inactive
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.

4 participants