Uh oh!
There was an error while loading. Please reload this page.
[IOS][ENHANCEMENT] - Adding locale prop to DatePickerIOS - #16639
[IOS][ENHANCEMENT] - Adding locale prop to DatePickerIOS#16639robertpaul01 wants to merge 1 commit into
Conversation
@facebook-github-bot label Android Attention: @shergin Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Can we add something here which will take user locale by default ?
Note: no need to use ternary here, just use props.locale and add user locale in defaultProps.
There was a problem hiding this comment.
If the locale isn't specified, the default device locale will be used.
chirag04
commented
Nov 2, 2017
@robertpaul01 are you using this to force 24hr format for the date time picker using the |
robertpaul01
commented
Nov 2, 2017
No, this is to allow certain date formats to be used such as dd/mm/yyyy or mm/dd/yyyy |
janicduplessis
commented
Nov 4, 2017
@robertpaul01 Thanks for the PR! What happens if you pass an invalid locale string? |
robertpaul01
commented
Nov 4, 2017
If the string is invalid, it will use the default device locale. |
janicduplessis
commented
Nov 4, 2017
@robertpaul01 Looks like your PR changes file permissions ( |
8ede1ce to
6cde2d1Comparerobertpaul01
commented
Nov 4, 2017
@janicduplessis I changed the permissions back. I overwrote the previous commit. |
janicduplessis
commented
Nov 4, 2017
@facebook-github-bot shipit |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@janicduplessis is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: <!-- Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html Happy contributing! --> While building a React Native application, I've come across the use case of wanting to set a specific locale for DatePickers irrespective of the users OS region setting. Since this is a feature available to native DatePicker components, I think it would be helpful to expose this in React Native as well. Testing can be done by passing a `locale` prop to a DatePickerIOS. Example: ``` <DatePickerIOS date={this.state.date} mode="date" locale="fr_FR" onDateChange={date => this.setState({ date: date })} /> ``` <!-- Help reviewers and the release process by writing your own release notes **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAl ] [ BUGFIX ] [-{Component}-] [ INTERNAL ] [ ENHANCEMENT ] [ {File} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| [CATEGORY] [TYPE] [LOCATION] - MESSAGE EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> [IOS][ENHANCEMENT][DatePickerIOS] - Adding a locale prop. Closesreact#16639 Differential Revision: D6241981 Pulled By: hramos fbshipit-source-id: 77b1b85c09f3e12d6b3e103b3d1ffd1f12e2cea9
Gongreg
commented
Nov 20, 2017
@robertpaul01 if you want to add example for locale, you can take it from my pull request. I opened it on August but nobody looked into it. |
Motivation
While building a React Native application, I've come across the use case of wanting to set a specific locale for DatePickers irrespective of the users OS region setting. Since this is a feature available to native DatePicker components, I think it would be helpful to expose this in React Native as well.
Test Plan
Testing can be done by passing a
localeprop to a DatePickerIOS. Example:Release Notes
[IOS][ENHANCEMENT][DatePickerIOS] - Adding a locale prop.