Skip to content

Support filtering timezones by country code#480

Merged
pimjansen merged 1 commit intoFakerPHP:mainfrom
aprat84:feat/country-timezones
Jun 22, 2022
Merged

Support filtering timezones by country code#480
pimjansen merged 1 commit intoFakerPHP:mainfrom
aprat84:feat/country-timezones

Conversation

@aprat84
Copy link
Copy Markdown

@aprat84 aprat84 commented Jun 10, 2022

What is the reason for this PR?

Filter creating timezones by country code.
Sometimes it is useful to assign a timezone from same country as the item we are going to create.

  • A new feature
  • Fixed an issue (resolve #ID)

Author's checklist

Summary of changes

Add $countryCode parameter to DateTime::timezone() method, to be able to filter the generated timezone by country.

Review checklist

  • All checks have passed
  • Changes are approved by maintainer

@pimjansen
Copy link
Copy Markdown

This is a breaking change so we cant accept this on the main stream

@bram-pkg
Copy link
Copy Markdown
Member

@pimjansen this is an @experimental class, so technically we can still change this.

@bram-pkg
Copy link
Copy Markdown
Member

@aprat84 if we manage to accept this, make sure to also change the method signature in the parent interface.

@aprat84 aprat84 force-pushed the feat/country-timezones branch from ebd97fd to 2a6a0dd Compare June 13, 2022 08:16
@aprat84
Copy link
Copy Markdown
Author

aprat84 commented Jun 13, 2022

@bram-pkg done! Also changed the phpdoc in Generator class.

Sorry for my ignorance, but, are you sure it is a BC? The $countryCode parameter is optional. If called as it is now (without parameter) its behavior does not change.

I reused the method cause I thought it would be cleaner, but this could be easily done in a separate method (ie: countryTimezone or timezoneInCountry), so we don't cause BC.

@aprat84 aprat84 force-pushed the feat/country-timezones branch from 2a6a0dd to 3235eae Compare June 17, 2022 08:07
@pimjansen pimjansen merged commit 135f6e9 into FakerPHP:main Jun 22, 2022
@aprat84 aprat84 deleted the feat/country-timezones branch June 23, 2022 07:57
@jefhar jefhar mentioned this pull request Mar 11, 2023
5 tasks
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.

3 participants