How to display German time with locale?
See original GitHub issueIssue Description
Hello I know that gifted chat supports Localized dates. I have tried to set the locale property to the gifted messenger with “de” to displaying German time without AM/PM. But this is not working. Anyone tried to change the time to German?
Steps to Reproduce / Code Snippets
<GiftedChat placeholder="Nachricht verfassen ..." messages={this.state.messages} onSend={this.onSend} locale="de" loadEarlier={this.state.loadEarlier} onLoadEarlier={this.onLoadEarlier} isLoadingEarlier={this.state.isLoadingEarlier} user={user} onInputTextChanged={this.onTyping} maxInputLength={200} renderFooter={this.renderFooter} renderActions={this.renderCustomActions} renderCustomView={this.renderCustomView} renderSystemMessage={this.renderSystemMessage} />
Additional Information
- React Native version: react-native-cli: 2.0.1 react-native: 0.49.5
- react-native-gifted-chat version: latest
- Platform(s) (iOS, Android, or both?): iOS
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Just faced the same issue. Be sure to load moment and your moment locale at startup before rendering GiftedChat: index.js:
Somehow this doesn’t work for me. Even if I import the locale in my component, inside of
GiftedChat
onlyen
is available throughmoment.locales()
It only works after I modify GiftedChat.js and explicitly add
import 'moment/locale/de'
in the imports. Not sure why the locale doesn’t get passed down to the GiftedChat component.