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

Support filtering timezones by country code #480

Merged
merged 1 commit into from
Jun 22, 2022

Conversation

aprat84
Copy link

@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

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

@bram-pkg
Copy link
Member

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

@bram-pkg
Copy link
Member

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

@aprat84
Copy link
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.

@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