@zohodesk/i18n 1.0.0-beta.18 → 1.0.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +76 -73
  2. package/es/components/I18NProvider.js +9 -2
  3. package/es/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  4. package/es/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  5. package/es/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  6. package/es/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  7. package/es/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  8. package/es/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  9. package/es/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  10. package/lib/components/I18NProvider.js +10 -2
  11. package/lib/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  12. package/lib/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  13. package/lib/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  14. package/lib/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  15. package/lib/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  16. package/lib/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  17. package/lib/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  18. package/package.json +28 -28
  19. package/src/I18NContext.js +2 -2
  20. package/src/components/DateTimeDiffFormat.js +254 -254
  21. package/src/components/FormatText.js +14 -14
  22. package/src/components/HOCI18N.js +37 -37
  23. package/src/components/I18N.js +72 -72
  24. package/src/components/I18NProvider.js +110 -106
  25. package/src/components/PluralFormat.js +37 -37
  26. package/src/components/UserTimeDiffFormat.js +94 -94
  27. package/src/components/__tests__/DateTimeDiffFormat.spec.js +618 -618
  28. package/src/components/__tests__/FormatText.spec.js +26 -26
  29. package/src/components/__tests__/HOCI18N.spec.js +33 -33
  30. package/src/components/__tests__/I18N.spec.js +29 -29
  31. package/src/components/__tests__/I18NProvider.spec.js +65 -65
  32. package/src/components/__tests__/PluralFormat.spec.js +27 -27
  33. package/src/components/__tests__/UserTimeDiffFormat.spec.js +1076 -1076
  34. package/src/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  35. package/src/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  36. package/src/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  37. package/src/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  38. package/src/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  39. package/src/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  40. package/src/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  41. package/src/index.js +33 -33
  42. package/src/utils.js +527 -527
package/README.md CHANGED
@@ -1,73 +1,76 @@
1
- # i18n
2
-
3
- # 1.0.0-beta.18
4
-
5
- - Localization feature added and incorporated into getI18NValue Method.
6
-
7
- # 1.0.0-beta.17
8
-
9
- - There was some i18n changes done in live before moving the date format build to live. Since we need these changes we have published it as new version.
10
-
11
- # 1.0.0-beta.16
12
-
13
- - DatePattern and dateTimePattern key has been changed for the date format build.
14
-
15
- # 1.0.0-beta.15.1
16
-
17
- - Zoho security version updated.
18
-
19
- # 1.0.0-beta.15
20
-
21
- - When working on date format build we have published I18n. Also, before moving date format build to master we had a emergency fix that need to be sent, so when publishing I18n we have published the date format changes with the next version.
22
-
23
- # 1.0.0-beta.14
24
-
25
- - Issue fixed in enable current year.
26
-
27
- # 1.0.0-beta.13
28
-
29
- - Issue fixed in due date.
30
-
31
- # 1.0.0-beta.12
32
-
33
- - Issue fixed in date Format Pattern.
34
-
35
- # 1.0.0-beta.11
36
-
37
- - Date Format Changes
38
-
39
- # 1.0.0-beta.10
40
-
41
- - Date Format Issue Fixes
42
-
43
- # 1.0.0-beta.9
44
-
45
- - Date Format Changes
46
-
47
- # 1.0.0-beta.8
48
-
49
- - ES Module Support Changes
50
-
51
- # 1.0.0-beta.7
52
-
53
- - 'userDateFormat' util method - 'others' function fix
54
-
55
- # 1.0.0-beta.6
56
-
57
- - Added new prop 'isNeedTime' for DateTimeDiffFormat Component
58
-
59
- # 1.0.0-beta.5
60
-
61
- - Timezone logic moved to @zohodesk/datetimejs
62
-
63
- # 1.0.0-beta.4
64
-
65
- - Added new prop 'page' for DateTimeDiffFormat Component
66
-
67
- # 1.0.0-beta.3
68
-
69
- - Added support for exact times along with relative times in format() function
70
-
71
- # 1.0.0-beta.0
72
-
73
- - Test Publish
1
+ # i18n
2
+
3
+ # 1.0.0-beta.19
4
+
5
+ - In this version we have made changes in i18n provider to call user date format function only if the time zone data is available.
6
+ # 1.0.0-beta.18
7
+
8
+ - Localization feature added and incorporated into getI18NValue Method.
9
+
10
+ # 1.0.0-beta.17
11
+
12
+ - There was some i18n changes done in live before moving the date format build to live. Since we need these changes we have published it as new version.
13
+
14
+ # 1.0.0-beta.16
15
+
16
+ - DatePattern and dateTimePattern key has been changed for the date format build.
17
+
18
+ # 1.0.0-beta.15.1
19
+
20
+ - Zoho security version updated.
21
+
22
+ # 1.0.0-beta.15
23
+
24
+ - When working on date format build we have published I18n. Also, before moving date format build to master we had a emergency fix that need to be sent, so when publishing I18n we have published the date format changes with the next version.
25
+
26
+ # 1.0.0-beta.14
27
+
28
+ - Issue fixed in enable current year.
29
+
30
+ # 1.0.0-beta.13
31
+
32
+ - Issue fixed in due date.
33
+
34
+ # 1.0.0-beta.12
35
+
36
+ - Issue fixed in date Format Pattern.
37
+
38
+ # 1.0.0-beta.11
39
+
40
+ - Date Format Changes
41
+
42
+ # 1.0.0-beta.10
43
+
44
+ - Date Format Issue Fixes
45
+
46
+ # 1.0.0-beta.9
47
+
48
+ - Date Format Changes
49
+
50
+ # 1.0.0-beta.8
51
+
52
+ - ES Module Support Changes
53
+
54
+ # 1.0.0-beta.7
55
+
56
+ - 'userDateFormat' util method - 'others' function fix
57
+
58
+ # 1.0.0-beta.6
59
+
60
+ - Added new prop 'isNeedTime' for DateTimeDiffFormat Component
61
+
62
+ # 1.0.0-beta.5
63
+
64
+ - Timezone logic moved to @zohodesk/datetimejs
65
+
66
+ # 1.0.0-beta.4
67
+
68
+ - Added new prop 'page' for DateTimeDiffFormat Component
69
+
70
+ # 1.0.0-beta.3
71
+
72
+ - Added support for exact times along with relative times in format() function
73
+
74
+ # 1.0.0-beta.0
75
+
76
+ - Test Publish
@@ -14,7 +14,10 @@ export default class I18NProvider extends React.Component {
14
14
  constructor(props, context) {
15
15
  super(props, context);
16
16
  i18NProviderUtils.getI18NValue = getI18NValue(props.i18n);
17
- i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, props.isEnabledCurrentYear);
17
+
18
+ if (props.tzData) {
19
+ i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, props.isEnabledCurrentYear);
20
+ }
18
21
  }
19
22
 
20
23
  componentDidUpdate(next) {
@@ -34,7 +37,11 @@ export default class I18NProvider extends React.Component {
34
37
  this.reject = rej;
35
38
  }).then(() => {
36
39
  i18NProviderUtils.getI18NValue = getI18NValue(nextProps.i18n);
37
- i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, this.props.isEnabledCurrentYear);
40
+
41
+ if (props.tzData) {
42
+ i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, this.props.isEnabledCurrentYear);
43
+ }
44
+
38
45
  this.promise = null;
39
46
  }, () => {
40
47
  this.promise = null;
@@ -1,258 +1,258 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`DateTimeDiffFormat component Should display other - greater time 1`] = `
4
- <span
5
- className={null}
6
- data-title={null}
7
- >
8
-
9
- </span>
10
- `;
11
-
12
- exports[`DateTimeDiffFormat component Should display other - less time 1`] = `
13
- <span
14
- className={null}
15
- data-title={null}
16
- >
17
- less 7 NaN-NaN-NaN
18
- </span>
19
- `;
20
-
21
- exports[`DateTimeDiffFormat component Should display other - same time 1`] = `
22
- <span
23
- className={null}
24
- data-title={null}
25
- >
26
- less 7 NaN-NaN-NaN
27
- </span>
28
- `;
29
-
30
- exports[`DateTimeDiffFormat component Should display other later- less time 1`] = `
31
- <span
32
- className={null}
33
- data-title={null}
34
- >
35
- less 7 NaN-NaN-NaN
36
- </span>
37
- `;
38
-
39
- exports[`DateTimeDiffFormat component Should display other later- less time 2`] = `
40
- <span
41
- className={null}
42
- data-title={null}
43
- >
44
-
45
- </span>
46
- `;
47
-
48
- exports[`DateTimeDiffFormat component Should display other later- same time 1`] = `
49
- <span
50
- className={null}
51
- data-title={null}
52
- >
53
- less 7 NaN-NaN-NaN
54
- </span>
55
- `;
56
-
57
- exports[`DateTimeDiffFormat component Should display others 1`] = `
58
- <span
59
- className={null}
60
- data-title={null}
61
- >
62
- less 7 NaN-NaN-NaN
63
- </span>
64
- `;
65
-
66
- exports[`DateTimeDiffFormat component Should display today ago 1`] = `
67
- <span
68
- className={null}
69
- data-title={null}
70
- >
71
-
72
- </span>
73
- `;
74
-
75
- exports[`DateTimeDiffFormat component Should display today key - greater than 24 hour 1`] = `
76
- <span
77
- className={null}
78
- data-title={null}
79
- >
80
-
81
- </span>
82
- `;
83
-
84
- exports[`DateTimeDiffFormat component Should display today key - less than 24 hour 1`] = `
85
- <span
86
- className={null}
87
- data-title={null}
88
- >
89
-
90
- </span>
91
- `;
92
-
93
- exports[`DateTimeDiffFormat component Should display today key - same time 1`] = `
94
- <span
95
- className={null}
96
- data-title={null}
97
- >
98
-
99
- </span>
100
- `;
101
-
102
- exports[`DateTimeDiffFormat component Should display today later 1`] = `
103
- <span
104
- className={null}
105
- data-title={null}
106
- >
107
-
108
- </span>
109
- `;
110
-
111
- exports[`DateTimeDiffFormat component Should display today1 1`] = `
112
- <div>
113
- <span
114
- className={null}
115
- data-title={null}
116
- >
117
-
118
- </span>
119
- <span
120
- className={null}
121
- data-title={null}
122
- >
123
-
124
- </span>
125
- <span
126
- className={null}
127
- data-title={null}
128
- >
129
-
130
- </span>
131
- <span
132
- className={null}
133
- data-title={null}
134
- >
135
-
136
- </span>
137
- <span
138
- className={null}
139
- data-title={null}
140
- >
141
-
142
- </span>
143
- <span
144
- className={null}
145
- data-title={null}
146
- >
147
-
148
- </span>
149
- <span
150
- className={null}
151
- data-title={null}
152
- >
153
-
154
- </span>
155
- <span
156
- className={null}
157
- data-title={null}
158
- >
159
-
160
- </span>
161
- <span
162
- className={null}
163
- data-title={null}
164
- >
165
-
166
- </span>
167
- <span
168
- className={null}
169
- data-title={null}
170
- >
171
-
172
- </span>
173
- <span
174
- className={null}
175
- data-title={null}
176
- >
177
-
178
- </span>
179
- <span
180
- className={null}
181
- data-title={null}
182
- >
183
-
184
- </span>
185
- </div>
186
- `;
187
-
188
- exports[`DateTimeDiffFormat component Should display tomorrow key - greater than 24 hour 1`] = `
189
- <span
190
- className={null}
191
- data-title={null}
192
- >
193
-
194
- </span>
195
- `;
196
-
197
- exports[`DateTimeDiffFormat component Should display tomorrow key - less than 24 hour 1`] = `
198
- <span
199
- className={null}
200
- data-title={null}
201
- >
202
-
203
- </span>
204
- `;
205
-
206
- exports[`DateTimeDiffFormat component Should display tomorrow key - same time 1`] = `
207
- <span
208
- className={null}
209
- data-title={null}
210
- >
211
-
212
- </span>
213
- `;
214
-
215
- exports[`DateTimeDiffFormat component Should display years and days 1`] = `
216
- <span
217
- className={null}
218
- data-title={null}
219
- >
220
- 2 years 62 days ago
221
- </span>
222
- `;
223
-
224
- exports[`DateTimeDiffFormat component Should display years and days1 1`] = `
225
- <span
226
- className={null}
227
- data-title={null}
228
- >
229
- 2 years 62 days later
230
- </span>
231
- `;
232
-
233
- exports[`DateTimeDiffFormat component Should display yesterday - greater than 24 hour 1`] = `
234
- <span
235
- className={null}
236
- data-title={null}
237
- >
238
-
239
- </span>
240
- `;
241
-
242
- exports[`DateTimeDiffFormat component Should display yesterday - less than 24 hour 1`] = `
243
- <span
244
- className={null}
245
- data-title={null}
246
- >
247
-
248
- </span>
249
- `;
250
-
251
- exports[`DateTimeDiffFormat component Should display yesterday - with same time 1`] = `
252
- <span
253
- className={null}
254
- data-title={null}
255
- >
256
-
257
- </span>
258
- `;
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`DateTimeDiffFormat component Should display other - greater time 1`] = `
4
+ <span
5
+ className={null}
6
+ data-title={null}
7
+ >
8
+
9
+ </span>
10
+ `;
11
+
12
+ exports[`DateTimeDiffFormat component Should display other - less time 1`] = `
13
+ <span
14
+ className={null}
15
+ data-title={null}
16
+ >
17
+ less 7 NaN-NaN-NaN
18
+ </span>
19
+ `;
20
+
21
+ exports[`DateTimeDiffFormat component Should display other - same time 1`] = `
22
+ <span
23
+ className={null}
24
+ data-title={null}
25
+ >
26
+ less 7 NaN-NaN-NaN
27
+ </span>
28
+ `;
29
+
30
+ exports[`DateTimeDiffFormat component Should display other later- less time 1`] = `
31
+ <span
32
+ className={null}
33
+ data-title={null}
34
+ >
35
+ less 7 NaN-NaN-NaN
36
+ </span>
37
+ `;
38
+
39
+ exports[`DateTimeDiffFormat component Should display other later- less time 2`] = `
40
+ <span
41
+ className={null}
42
+ data-title={null}
43
+ >
44
+
45
+ </span>
46
+ `;
47
+
48
+ exports[`DateTimeDiffFormat component Should display other later- same time 1`] = `
49
+ <span
50
+ className={null}
51
+ data-title={null}
52
+ >
53
+ less 7 NaN-NaN-NaN
54
+ </span>
55
+ `;
56
+
57
+ exports[`DateTimeDiffFormat component Should display others 1`] = `
58
+ <span
59
+ className={null}
60
+ data-title={null}
61
+ >
62
+ less 7 NaN-NaN-NaN
63
+ </span>
64
+ `;
65
+
66
+ exports[`DateTimeDiffFormat component Should display today ago 1`] = `
67
+ <span
68
+ className={null}
69
+ data-title={null}
70
+ >
71
+
72
+ </span>
73
+ `;
74
+
75
+ exports[`DateTimeDiffFormat component Should display today key - greater than 24 hour 1`] = `
76
+ <span
77
+ className={null}
78
+ data-title={null}
79
+ >
80
+
81
+ </span>
82
+ `;
83
+
84
+ exports[`DateTimeDiffFormat component Should display today key - less than 24 hour 1`] = `
85
+ <span
86
+ className={null}
87
+ data-title={null}
88
+ >
89
+
90
+ </span>
91
+ `;
92
+
93
+ exports[`DateTimeDiffFormat component Should display today key - same time 1`] = `
94
+ <span
95
+ className={null}
96
+ data-title={null}
97
+ >
98
+
99
+ </span>
100
+ `;
101
+
102
+ exports[`DateTimeDiffFormat component Should display today later 1`] = `
103
+ <span
104
+ className={null}
105
+ data-title={null}
106
+ >
107
+
108
+ </span>
109
+ `;
110
+
111
+ exports[`DateTimeDiffFormat component Should display today1 1`] = `
112
+ <div>
113
+ <span
114
+ className={null}
115
+ data-title={null}
116
+ >
117
+
118
+ </span>
119
+ <span
120
+ className={null}
121
+ data-title={null}
122
+ >
123
+
124
+ </span>
125
+ <span
126
+ className={null}
127
+ data-title={null}
128
+ >
129
+
130
+ </span>
131
+ <span
132
+ className={null}
133
+ data-title={null}
134
+ >
135
+
136
+ </span>
137
+ <span
138
+ className={null}
139
+ data-title={null}
140
+ >
141
+
142
+ </span>
143
+ <span
144
+ className={null}
145
+ data-title={null}
146
+ >
147
+
148
+ </span>
149
+ <span
150
+ className={null}
151
+ data-title={null}
152
+ >
153
+
154
+ </span>
155
+ <span
156
+ className={null}
157
+ data-title={null}
158
+ >
159
+
160
+ </span>
161
+ <span
162
+ className={null}
163
+ data-title={null}
164
+ >
165
+
166
+ </span>
167
+ <span
168
+ className={null}
169
+ data-title={null}
170
+ >
171
+
172
+ </span>
173
+ <span
174
+ className={null}
175
+ data-title={null}
176
+ >
177
+
178
+ </span>
179
+ <span
180
+ className={null}
181
+ data-title={null}
182
+ >
183
+
184
+ </span>
185
+ </div>
186
+ `;
187
+
188
+ exports[`DateTimeDiffFormat component Should display tomorrow key - greater than 24 hour 1`] = `
189
+ <span
190
+ className={null}
191
+ data-title={null}
192
+ >
193
+
194
+ </span>
195
+ `;
196
+
197
+ exports[`DateTimeDiffFormat component Should display tomorrow key - less than 24 hour 1`] = `
198
+ <span
199
+ className={null}
200
+ data-title={null}
201
+ >
202
+
203
+ </span>
204
+ `;
205
+
206
+ exports[`DateTimeDiffFormat component Should display tomorrow key - same time 1`] = `
207
+ <span
208
+ className={null}
209
+ data-title={null}
210
+ >
211
+
212
+ </span>
213
+ `;
214
+
215
+ exports[`DateTimeDiffFormat component Should display years and days 1`] = `
216
+ <span
217
+ className={null}
218
+ data-title={null}
219
+ >
220
+ 2 years 62 days ago
221
+ </span>
222
+ `;
223
+
224
+ exports[`DateTimeDiffFormat component Should display years and days1 1`] = `
225
+ <span
226
+ className={null}
227
+ data-title={null}
228
+ >
229
+ 2 years 62 days later
230
+ </span>
231
+ `;
232
+
233
+ exports[`DateTimeDiffFormat component Should display yesterday - greater than 24 hour 1`] = `
234
+ <span
235
+ className={null}
236
+ data-title={null}
237
+ >
238
+
239
+ </span>
240
+ `;
241
+
242
+ exports[`DateTimeDiffFormat component Should display yesterday - less than 24 hour 1`] = `
243
+ <span
244
+ className={null}
245
+ data-title={null}
246
+ >
247
+
248
+ </span>
249
+ `;
250
+
251
+ exports[`DateTimeDiffFormat component Should display yesterday - with same time 1`] = `
252
+ <span
253
+ className={null}
254
+ data-title={null}
255
+ >
256
+
257
+ </span>
258
+ `;