You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/reactnative/guides/date-time-formatting.mdx
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ In this guide we will learn how date a time formatting can be customized within
7
7
8
8
## SDK components displaying date & time
9
9
10
-
The following components provided by the SDK display datetime:
10
+
The following components provided by the SDK display date time:
11
11
12
12
-`ChannelPreviewStatus` - Component showing last message date and time in `ChannelList`.
13
13
-`ImageGalleryHeader` - Component showing the header in the `ImageGallery`.
@@ -19,7 +19,7 @@ The following components provided by the SDK display datetime:
19
19
20
20
## Format Customization
21
21
22
-
The datetime format can be customized by providing date format through the `i18n` JSON.
22
+
The date time format can be customized by providing date format through the `i18n` JSON.
23
23
24
24
### Date & time formatting with i18n service
25
25
@@ -31,7 +31,7 @@ Formatting via i18n service allows for SDK wide configuration. The configuration
31
31
- Allows for high re-usability - apply the same configuration in multiple places via the same translation key.
32
32
- Allows for custom formatting logic.
33
33
34
-
The default datetime formatting configuration is stored in the JSON translation files. The default translation keys are namespaced with prefix `timestamp/` followed by the component name. For example, the message date formatting can be targeted via `timestamp/MessageTimestamp`, because the underlying component is called `MessageTimestamp`.
34
+
The default date time formatting configuration is stored in the JSON translation files. The default translation keys are namespaced with prefix `timestamp/` followed by the component name. For example, the message date formatting can be targeted via `timestamp/MessageTimestamp`, because the underlying component is called `MessageTimestamp`.
35
35
36
36
We can apply custom configuration in all the translation JSON files. It could look similar to the following example key-value pair.
37
37
@@ -79,11 +79,11 @@ Let's dissect the example:
79
79
80
80
**Params**:
81
81
82
-
-`calendar` - This is a boolean field to decide if the date format should be in calendar format or not. The default value is `false`.
82
+
-`calendar` - This is a `Boolean` field to decide if the date format should be in calendar format or not. The default value is `false`.
83
83
-`calendarFormats` - This is an object that contains the formats for the calendar. The default value is `{ sameDay: 'LT', nextDay: 'LT', nextWeek: 'dddd', lastDay: 'dddd', lastWeek: 'dddd', sameElse: 'L' }`.
84
84
-`format` - This is a string that contains the format of the date.
85
85
86
-
If calendar formatting is enabled, the dates are formatted with time-relative words ("yesterday at ...", "last ..."). The calendar strings can be further customized with `calendarFormats` object. The `calendarFormats` object has to cover all the formatting cases as shows the example below:
86
+
If calendar formatting is enabled, the dates are formatted with time-relative words (`"yesterday at ..."`, `"last ..."`). The calendar strings can be further customized with `calendarFormats` object. The `calendarFormats` object has to cover all the formatting cases as shows the example below:
87
87
88
88
```js
89
89
{
@@ -106,7 +106,7 @@ If `calendar` formatting is enabled, the `format` prop would be ignored. So to a
106
106
The described rules follow the formatting rules required by the i18n library used under the hood - `i18next`. You can learn more about the rules in [the formatting section of the `i18next` documentation](https://www.i18next.com/translation-function/formatting#basic-usage).
107
107
:::
108
108
109
-
### Custom datetime formatter functions
109
+
### Custom date time formatter functions
110
110
111
111
Besides overriding the configuration parameters, we can override the default `timestampFormatter` function by providing custom `Streami18n` instance:
0 commit comments