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?
<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}
/>
Just faced the same issue. Be sure to load moment and your moment locale at startup before rendering GiftedChat:
index.js:
import "moment";
import "moment/locale/de";
Somehow this doesn't work for me. Even if I import the locale in my component, inside of GiftedChat only en is available through moment.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.
None of this works for me
Yep, also doesn't work here
rn 0.49.3
gifted 0.2.9
moment 2.21.0
moment.locales() after app start -> ["en", "en-gb", "zh-cn", "zh-hk"]
moment.locale() -> zh-hk
<GiftedChat ... locale={'zh-hk'} />
Import with
import moment from 'moment/min/moment-with-locales';
and call the following function before rendering GiftedChat with your chosen locale prop. (i.e. in componentWillMount())
moment.locale(YOUR_LOCALE_IDENTIFIER);
Most helpful comment
Just faced the same issue. Be sure to load moment and your moment locale at startup before rendering GiftedChat:
index.js: