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

Feature/international-calendar #106

Merged
merged 4 commits into from
Jul 11, 2023
Merged

Conversation

lebaudantoine
Copy link
Collaborator

@lebaudantoine lebaudantoine commented Jun 26, 2023

Purpose

Improve international capabilities of the DatePicker component using alocale props or the Cunningham provider. Dates would be automatically displayed in the appropriate calendar system.

Proposal

  • Expose currentLocale value in the CunninghamContext.
  • By default, synchronize DatePicker's calendar system with currentLocale value.
  • Add locale props to the DatePickercomponent that overrides currentLocale value.
  • Automatically update calendar system in the DatePicker component using the I18nProvider.
  • Add tests on the DatePicker component.
  • Add tests on the CunninghamProvider

To be discussed

with @jbpenrath

  • Timezone.
  • Locale values (corner cases).
  • CunninghamProvider current modifications and potential refactoring.

@lebaudantoine lebaudantoine added the documentation Improvements or additions to documentation label Jun 26, 2023
@lebaudantoine lebaudantoine self-assigned this Jun 26, 2023
@changeset-bot
Copy link

changeset-bot bot commented Jun 26, 2023

🦋 Changeset detected

Latest commit: 89e13ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@openfun/cunningham-react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@jbpenrath jbpenrath left a comment

Choose a reason for hiding this comment

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

LGTM ✅

@lebaudantoine lebaudantoine marked this pull request as draft June 26, 2023 17:17
@lebaudantoine lebaudantoine force-pushed the feature/international-calendar branch from 92345b1 to f1f0d07 Compare June 26, 2023 17:21
@lebaudantoine lebaudantoine changed the title 📝(react) add an international calendar example in the DatePicker docs Feature/ support international calendar in DatePicker component Jun 26, 2023
@lebaudantoine lebaudantoine added improvement and removed documentation Improvements or additions to documentation labels Jun 26, 2023
@lebaudantoine lebaudantoine changed the title Feature/ support international calendar in DatePicker component Feature/international-calendar Jun 26, 2023
@lebaudantoine lebaudantoine force-pushed the feature/international-calendar branch from f1f0d07 to 1a7451f Compare June 26, 2023 17:25
@lebaudantoine lebaudantoine changed the title Feature/international-calendar [WIP] Feature/international-calendar Jun 26, 2023
@lebaudantoine lebaudantoine mentioned this pull request Jun 27, 2023
10 tasks
Comment on lines 84 to 85
currentLocale:
(locales[currentLocale] && currentLocale) || DEFAULT_LOCALE,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This logic could be factorized with the locale computation. WDYT @jbpenrath ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would you want me to add a test for this new feature ?

Copy link
Member

Choose a reason for hiding this comment

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

Yup please

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

@lebaudantoine lebaudantoine changed the title [WIP] Feature/international-calendar Feature/international-calendar Jun 27, 2023
@lebaudantoine lebaudantoine force-pushed the feature/international-calendar branch 2 times, most recently from b7388d6 to 54ab037 Compare June 28, 2023 06:23
@lebaudantoine lebaudantoine removed the request for review from jbpenrath June 28, 2023 08:28
@lebaudantoine lebaudantoine force-pushed the feature/international-calendar branch 5 times, most recently from 8026ddc to 6cef84a Compare June 28, 2023 12:09
@lebaudantoine lebaudantoine marked this pull request as ready for review June 28, 2023 12:48
Expose `currentLocale` value to let know its subscribers
what is the locale value currently in use.
Component was lacking some customization capabilities.
Using the browser calendar system wasn't enough modular.
This introduces a `locale` props, that allows a higher
customization of the component. By default, the calendar
system of the DatePicker is synchronized with the Cunningham
Provider.
@lebaudantoine lebaudantoine force-pushed the feature/international-calendar branch from 6cef84a to 5cb45e3 Compare July 11, 2023 18:51
Show international capabilities of the `DatePicker` component using the
`locale` props and the Cunningham provider. Dates would
be automatically displayed in the appropriate calendar system.
@lebaudantoine lebaudantoine force-pushed the feature/international-calendar branch 5 times, most recently from 7892db6 to c012f54 Compare July 11, 2023 22:37
Documentation was outdated, as the range date picker is now available.
@lebaudantoine lebaudantoine force-pushed the feature/international-calendar branch from f37ed3f to 89e13ff Compare July 11, 2023 22:44
@lebaudantoine lebaudantoine merged commit 5338e21 into main Jul 11, 2023
@lebaudantoine lebaudantoine deleted the feature/international-calendar branch July 11, 2023 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants