question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to display German time with locale?

See original GitHub issue

Issue 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:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

4reactions
olofdcommented, Nov 13, 2017

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";
3reactions
Mexxeriocommented, Nov 13, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Date and time localization - Lokalise Blog
It returns the weekday, day, month, and year in German. The next locale is ar-EG (Arabic language). The output is: الأحد، ٨ ...
Read more >
Inconsistent date time format for German locale - Stack Overflow
I can suggest a workaround: SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.GERMAN); DateFormatSymbols dfs ...
Read more >
DateTime::Locale::de_DE - MetaCPAN
This pod file contains examples of the locale data available for the German Germany locale. Days. Wide (format). Montag. Dienstag.
Read more >
How to Localize Date and Time Formats in Android | Phrase
... this tutorial outlines best practices for displaying date and time formats to Android users based on their time zone and locale.
Read more >
Date Formats (International Language Environments Guide)
Locale Convention Example Canadian (English and French) yyyy‑mm‑dd 1998‑08‑13 Danish yyyy‑mm‑dd 1999‑08‑24 Finnish dd.mm.yyyy 13.08.1998
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found