@zohodesk/i18n 1.0.0-beta.34 → 1.0.0-beta.35-murphy
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.
- package/docs/murphy/01-MURPHY_OVERVIEW.md +148 -0
- package/docs/murphy/02-MURPHY_ARCHITECTURE.md +283 -0
- package/docs/murphy/03-MURPHY_BACKEND_CONFIG.md +337 -0
- package/docs/murphy/04-MURPHY_FRONTEND_INIT.md +437 -0
- package/docs/murphy/05-MURPHY_DESK_CLIENT_USAGE.md +467 -0
- package/docs/murphy/06-MURPHY_I18N_INTEGRATION.md +402 -0
- package/docs/murphy/07-MURPHY_WHY_I18N_APPROACH.md +391 -0
- package/es/components/DateTimeDiffFormat.js +5 -19
- package/es/components/FormatText.js +2 -2
- package/es/components/HOCI18N.js +32 -43
- package/es/components/I18N.js +2 -13
- package/es/components/I18NProvider.js +0 -9
- package/es/components/PluralFormat.js +3 -5
- package/es/components/UserTimeDiffFormat.js +5 -9
- package/es/components/__tests__/DateTimeDiffFormat.spec.js +157 -221
- package/es/components/__tests__/FormatText.spec.js +2 -2
- package/es/components/__tests__/HOCI18N.spec.js +2 -4
- package/es/components/__tests__/I18N.spec.js +6 -4
- package/es/components/__tests__/I18NProvider.spec.js +4 -4
- package/es/components/__tests__/PluralFormat.spec.js +2 -2
- package/es/components/__tests__/UserTimeDiffFormat.spec.js +249 -348
- package/es/index.js +1 -0
- package/es/utils/__tests__/jsxTranslations.spec.js +3 -7
- package/es/utils/errorReporter.js +31 -0
- package/es/utils/index.js +42 -92
- package/es/utils/jsxTranslations.js +34 -52
- package/lib/I18NContext.js +2 -7
- package/lib/components/DateTimeDiffFormat.js +46 -87
- package/lib/components/FormatText.js +18 -41
- package/lib/components/HOCI18N.js +24 -59
- package/lib/components/I18N.js +27 -64
- package/lib/components/I18NProvider.js +27 -63
- package/lib/components/PluralFormat.js +24 -50
- package/lib/components/UserTimeDiffFormat.js +43 -72
- package/lib/components/__tests__/DateTimeDiffFormat.spec.js +95 -165
- package/lib/components/__tests__/FormatText.spec.js +3 -10
- package/lib/components/__tests__/HOCI18N.spec.js +3 -14
- package/lib/components/__tests__/I18N.spec.js +4 -12
- package/lib/components/__tests__/I18NProvider.spec.js +8 -23
- package/lib/components/__tests__/PluralFormat.spec.js +3 -11
- package/lib/components/__tests__/UserTimeDiffFormat.spec.js +157 -225
- package/lib/index.js +25 -23
- package/lib/utils/__tests__/jsxTranslations.spec.js +1 -12
- package/lib/utils/errorReporter.js +39 -0
- package/lib/utils/index.js +49 -125
- package/lib/utils/jsxTranslations.js +61 -100
- package/package.json +1 -1
- package/src/index.js +5 -0
- package/src/utils/errorReporter.js +36 -0
- package/src/utils/index.js +8 -1
- package/src/utils/jsxTranslations.js +8 -1
|
@@ -7,10 +7,10 @@ let tzData = {
|
|
|
7
7
|
untils: [1013911200000, null]
|
|
8
8
|
};
|
|
9
9
|
let fromTzData = tzData,
|
|
10
|
-
|
|
10
|
+
toTzData = tzData;
|
|
11
11
|
describe('DateTimeDiffFormat component', () => {
|
|
12
12
|
it('Should display yesterday - with same time', () => {
|
|
13
|
-
let ele = renderer.create(
|
|
13
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
14
14
|
i18n: {
|
|
15
15
|
today: 'today',
|
|
16
16
|
yesterday: 'yesterday'
|
|
@@ -32,18 +32,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
32
32
|
key: 'tomorrow',
|
|
33
33
|
params: ['hh', 'mm', 'ss']
|
|
34
34
|
},
|
|
35
|
-
others:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = _ref;
|
|
42
|
-
|
|
35
|
+
others: ({
|
|
36
|
+
years,
|
|
37
|
+
days,
|
|
38
|
+
hours,
|
|
39
|
+
minutes
|
|
40
|
+
}) => {
|
|
43
41
|
if (days > 7) {
|
|
44
42
|
return 'DD-MM-YYYY';
|
|
45
43
|
}
|
|
46
|
-
|
|
47
44
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
48
45
|
},
|
|
49
46
|
ago: "ago",
|
|
@@ -53,7 +50,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
53
50
|
expect(tree).toMatchSnapshot();
|
|
54
51
|
});
|
|
55
52
|
it('Should display yesterday - less than 24 hour', () => {
|
|
56
|
-
let ele = renderer.create(
|
|
53
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
57
54
|
i18n: {
|
|
58
55
|
today: 'today',
|
|
59
56
|
yesterday: 'yesterday'
|
|
@@ -75,18 +72,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
75
72
|
key: 'tomorrow',
|
|
76
73
|
params: ['hh', 'mm', 'ss']
|
|
77
74
|
},
|
|
78
|
-
others:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} = _ref2;
|
|
85
|
-
|
|
75
|
+
others: ({
|
|
76
|
+
years,
|
|
77
|
+
days,
|
|
78
|
+
hours,
|
|
79
|
+
minutes
|
|
80
|
+
}) => {
|
|
86
81
|
if (days > 7) {
|
|
87
82
|
return 'DD-MM-YYYY';
|
|
88
83
|
}
|
|
89
|
-
|
|
90
84
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
91
85
|
},
|
|
92
86
|
ago: "ago",
|
|
@@ -96,7 +90,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
96
90
|
expect(tree).toMatchSnapshot();
|
|
97
91
|
});
|
|
98
92
|
it('Should display yesterday - greater than 24 hour', () => {
|
|
99
|
-
let ele = renderer.create(
|
|
93
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
100
94
|
i18n: {
|
|
101
95
|
today: 'today',
|
|
102
96
|
yesterday: 'yesterday'
|
|
@@ -118,18 +112,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
118
112
|
key: 'tomorrow',
|
|
119
113
|
params: ['hh', 'mm', 'ss']
|
|
120
114
|
},
|
|
121
|
-
others:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
} = _ref3;
|
|
128
|
-
|
|
115
|
+
others: ({
|
|
116
|
+
years,
|
|
117
|
+
days,
|
|
118
|
+
hours,
|
|
119
|
+
minutes
|
|
120
|
+
}) => {
|
|
129
121
|
if (days > 7) {
|
|
130
122
|
return 'DD-MM-YYYY';
|
|
131
123
|
}
|
|
132
|
-
|
|
133
124
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
134
125
|
},
|
|
135
126
|
ago: "ago",
|
|
@@ -139,7 +130,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
139
130
|
expect(tree).toMatchSnapshot();
|
|
140
131
|
});
|
|
141
132
|
it('Should display today key - same time', () => {
|
|
142
|
-
let ele = renderer.create(
|
|
133
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
143
134
|
i18n: {
|
|
144
135
|
today: 'today',
|
|
145
136
|
yesterday: 'yesterday'
|
|
@@ -161,18 +152,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
161
152
|
key: 'tomorrow',
|
|
162
153
|
params: ['hh', 'mm', 'ss']
|
|
163
154
|
},
|
|
164
|
-
others:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
} = _ref4;
|
|
171
|
-
|
|
155
|
+
others: ({
|
|
156
|
+
years,
|
|
157
|
+
days,
|
|
158
|
+
hours,
|
|
159
|
+
minutes
|
|
160
|
+
}) => {
|
|
172
161
|
if (days > 7) {
|
|
173
162
|
return 'DD-MM-YYYY';
|
|
174
163
|
}
|
|
175
|
-
|
|
176
164
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
177
165
|
},
|
|
178
166
|
ago: "ago",
|
|
@@ -182,7 +170,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
182
170
|
expect(tree).toMatchSnapshot();
|
|
183
171
|
});
|
|
184
172
|
it('Should display today key - less than 24 hour', () => {
|
|
185
|
-
let ele = renderer.create(
|
|
173
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
186
174
|
i18n: {
|
|
187
175
|
today: 'today',
|
|
188
176
|
yesterday: 'yesterday'
|
|
@@ -204,18 +192,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
204
192
|
key: 'tomorrow',
|
|
205
193
|
params: ['hh', 'mm', 'ss']
|
|
206
194
|
},
|
|
207
|
-
others:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
} = _ref5;
|
|
214
|
-
|
|
195
|
+
others: ({
|
|
196
|
+
years,
|
|
197
|
+
days,
|
|
198
|
+
hours,
|
|
199
|
+
minutes
|
|
200
|
+
}) => {
|
|
215
201
|
if (days > 7) {
|
|
216
202
|
return 'DD-MM-YYYY';
|
|
217
203
|
}
|
|
218
|
-
|
|
219
204
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
220
205
|
},
|
|
221
206
|
ago: "ago",
|
|
@@ -225,7 +210,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
225
210
|
expect(tree).toMatchSnapshot();
|
|
226
211
|
});
|
|
227
212
|
it('Should display today key - greater than 24 hour', () => {
|
|
228
|
-
let ele = renderer.create(
|
|
213
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
229
214
|
i18n: {
|
|
230
215
|
today: 'today',
|
|
231
216
|
yesterday: 'yesterday'
|
|
@@ -247,18 +232,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
247
232
|
key: 'tomorrow',
|
|
248
233
|
params: ['hh', 'mm', 'ss']
|
|
249
234
|
},
|
|
250
|
-
others:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
} = _ref6;
|
|
257
|
-
|
|
235
|
+
others: ({
|
|
236
|
+
years,
|
|
237
|
+
days,
|
|
238
|
+
hours,
|
|
239
|
+
minutes
|
|
240
|
+
}) => {
|
|
258
241
|
if (days > 7) {
|
|
259
242
|
return 'DD-MM-YYYY';
|
|
260
243
|
}
|
|
261
|
-
|
|
262
244
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
263
245
|
},
|
|
264
246
|
ago: "ago",
|
|
@@ -268,7 +250,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
268
250
|
expect(tree).toMatchSnapshot();
|
|
269
251
|
});
|
|
270
252
|
it('Should display tomorrow key - same time', () => {
|
|
271
|
-
let ele = renderer.create(
|
|
253
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
272
254
|
i18n: {
|
|
273
255
|
today: 'today',
|
|
274
256
|
yesterday: 'yesterday'
|
|
@@ -290,18 +272,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
290
272
|
key: 'tomorrow',
|
|
291
273
|
params: ['hh', 'mm', 'ss']
|
|
292
274
|
},
|
|
293
|
-
others:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
} = _ref7;
|
|
300
|
-
|
|
275
|
+
others: ({
|
|
276
|
+
years,
|
|
277
|
+
days,
|
|
278
|
+
hours,
|
|
279
|
+
minutes
|
|
280
|
+
}) => {
|
|
301
281
|
if (days > 7) {
|
|
302
282
|
return 'DD-MM-YYYY';
|
|
303
283
|
}
|
|
304
|
-
|
|
305
284
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
306
285
|
},
|
|
307
286
|
ago: "ago",
|
|
@@ -311,7 +290,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
311
290
|
expect(tree).toMatchSnapshot();
|
|
312
291
|
});
|
|
313
292
|
it('Should display tomorrow key - less than 24 hour', () => {
|
|
314
|
-
let ele = renderer.create(
|
|
293
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
315
294
|
i18n: {
|
|
316
295
|
today: 'today',
|
|
317
296
|
yesterday: 'yesterday'
|
|
@@ -333,18 +312,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
333
312
|
key: 'tomorrow',
|
|
334
313
|
params: ['hh', 'mm', 'ss']
|
|
335
314
|
},
|
|
336
|
-
others:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
} = _ref8;
|
|
343
|
-
|
|
315
|
+
others: ({
|
|
316
|
+
years,
|
|
317
|
+
days,
|
|
318
|
+
hours,
|
|
319
|
+
minutes
|
|
320
|
+
}) => {
|
|
344
321
|
if (days > 7) {
|
|
345
322
|
return 'DD-MM-YYYY';
|
|
346
323
|
}
|
|
347
|
-
|
|
348
324
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
349
325
|
},
|
|
350
326
|
ago: "ago",
|
|
@@ -354,7 +330,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
354
330
|
expect(tree).toMatchSnapshot();
|
|
355
331
|
});
|
|
356
332
|
it('Should display tomorrow key - greater than 24 hour', () => {
|
|
357
|
-
let ele = renderer.create(
|
|
333
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
358
334
|
i18n: {
|
|
359
335
|
today: 'today',
|
|
360
336
|
yesterday: 'yesterday'
|
|
@@ -376,18 +352,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
376
352
|
key: 'tomorrow',
|
|
377
353
|
params: ['hh', 'mm', 'ss']
|
|
378
354
|
},
|
|
379
|
-
others:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
} = _ref9;
|
|
386
|
-
|
|
355
|
+
others: ({
|
|
356
|
+
years,
|
|
357
|
+
days,
|
|
358
|
+
hours,
|
|
359
|
+
minutes
|
|
360
|
+
}) => {
|
|
387
361
|
if (days > 7) {
|
|
388
362
|
return 'DD-MM-YYYY';
|
|
389
363
|
}
|
|
390
|
-
|
|
391
364
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
392
365
|
},
|
|
393
366
|
ago: "ago",
|
|
@@ -397,7 +370,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
397
370
|
expect(tree).toMatchSnapshot();
|
|
398
371
|
});
|
|
399
372
|
it('Should display other - same time', () => {
|
|
400
|
-
let ele = renderer.create(
|
|
373
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
401
374
|
i18n: {
|
|
402
375
|
today: 'today',
|
|
403
376
|
yesterday: 'yesterday'
|
|
@@ -419,19 +392,16 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
419
392
|
key: 'tomorrow',
|
|
420
393
|
params: ['hh', 'mm', 'ss']
|
|
421
394
|
},
|
|
422
|
-
others:
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
} = _ref10;
|
|
430
|
-
|
|
395
|
+
others: ({
|
|
396
|
+
years,
|
|
397
|
+
days,
|
|
398
|
+
hours,
|
|
399
|
+
minutes,
|
|
400
|
+
suffix
|
|
401
|
+
}) => {
|
|
431
402
|
if (days > 7) {
|
|
432
403
|
return 'DD-MM-YYYY';
|
|
433
404
|
}
|
|
434
|
-
|
|
435
405
|
return '[less 7] DD-MM-YYYY';
|
|
436
406
|
},
|
|
437
407
|
ago: "ago",
|
|
@@ -441,7 +411,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
441
411
|
expect(tree).toMatchSnapshot();
|
|
442
412
|
});
|
|
443
413
|
it('Should display other - greater time', () => {
|
|
444
|
-
let ele = renderer.create(
|
|
414
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
445
415
|
i18n: {
|
|
446
416
|
today: 'today',
|
|
447
417
|
yesterday: 'yesterday'
|
|
@@ -463,19 +433,16 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
463
433
|
key: 'tomorrow',
|
|
464
434
|
params: ['hh', 'mm', 'ss']
|
|
465
435
|
},
|
|
466
|
-
others:
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
} = _ref11;
|
|
474
|
-
|
|
436
|
+
others: ({
|
|
437
|
+
years,
|
|
438
|
+
days,
|
|
439
|
+
hours,
|
|
440
|
+
minutes,
|
|
441
|
+
suffix
|
|
442
|
+
}) => {
|
|
475
443
|
if (days > 7) {
|
|
476
444
|
return 'DD-MM-YYYY';
|
|
477
445
|
}
|
|
478
|
-
|
|
479
446
|
return '[less 7] DD-MM-YYYY';
|
|
480
447
|
},
|
|
481
448
|
ago: "ago",
|
|
@@ -485,7 +452,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
485
452
|
expect(tree).toMatchSnapshot();
|
|
486
453
|
});
|
|
487
454
|
it('Should display other - less time', () => {
|
|
488
|
-
let ele = renderer.create(
|
|
455
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
489
456
|
i18n: {
|
|
490
457
|
today: 'today',
|
|
491
458
|
yesterday: 'yesterday'
|
|
@@ -507,19 +474,16 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
507
474
|
key: 'tomorrow',
|
|
508
475
|
params: ['hh', 'mm', 'ss']
|
|
509
476
|
},
|
|
510
|
-
others:
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
} = _ref12;
|
|
518
|
-
|
|
477
|
+
others: ({
|
|
478
|
+
years,
|
|
479
|
+
days,
|
|
480
|
+
hours,
|
|
481
|
+
minutes,
|
|
482
|
+
suffix
|
|
483
|
+
}) => {
|
|
519
484
|
if (days > 7) {
|
|
520
485
|
return 'DD-MM-YYYY';
|
|
521
486
|
}
|
|
522
|
-
|
|
523
487
|
return '[less 7] DD-MM-YYYY';
|
|
524
488
|
},
|
|
525
489
|
ago: "ago",
|
|
@@ -529,7 +493,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
529
493
|
expect(tree).toMatchSnapshot();
|
|
530
494
|
});
|
|
531
495
|
it('Should display other later- same time', () => {
|
|
532
|
-
let ele = renderer.create(
|
|
496
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
533
497
|
i18n: {
|
|
534
498
|
today: 'today',
|
|
535
499
|
yesterday: 'yesterday'
|
|
@@ -551,20 +515,17 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
551
515
|
key: 'tomorrow',
|
|
552
516
|
params: ['hh', 'mm', 'ss']
|
|
553
517
|
},
|
|
554
|
-
others:
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
} = _ref13;
|
|
563
|
-
|
|
518
|
+
others: ({
|
|
519
|
+
years,
|
|
520
|
+
days,
|
|
521
|
+
hours,
|
|
522
|
+
minutes,
|
|
523
|
+
suffix,
|
|
524
|
+
isWithInAWeek
|
|
525
|
+
}) => {
|
|
564
526
|
if (days > 7) {
|
|
565
527
|
return 'DD-MM-YYYY';
|
|
566
528
|
}
|
|
567
|
-
|
|
568
529
|
return '[less 7] DD-MM-YYYY';
|
|
569
530
|
},
|
|
570
531
|
ago: "ago",
|
|
@@ -574,7 +535,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
574
535
|
expect(tree).toMatchSnapshot();
|
|
575
536
|
});
|
|
576
537
|
it('Should display other later- less time', () => {
|
|
577
|
-
let ele = renderer.create(
|
|
538
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
578
539
|
i18n: {
|
|
579
540
|
today: 'today',
|
|
580
541
|
yesterday: 'yesterday'
|
|
@@ -596,19 +557,16 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
596
557
|
key: 'tomorrow',
|
|
597
558
|
params: ['hh', 'mm', 'ss']
|
|
598
559
|
},
|
|
599
|
-
others:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
} = _ref14;
|
|
607
|
-
|
|
560
|
+
others: ({
|
|
561
|
+
years,
|
|
562
|
+
days,
|
|
563
|
+
hours,
|
|
564
|
+
minutes,
|
|
565
|
+
suffix
|
|
566
|
+
}) => {
|
|
608
567
|
if (days > 7) {
|
|
609
568
|
return 'DD-MM-YYYY';
|
|
610
569
|
}
|
|
611
|
-
|
|
612
570
|
return '[less 7] DD-MM-YYYY';
|
|
613
571
|
},
|
|
614
572
|
ago: "ago",
|
|
@@ -618,7 +576,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
618
576
|
expect(tree).toMatchSnapshot();
|
|
619
577
|
});
|
|
620
578
|
it('Should display other later- less time', () => {
|
|
621
|
-
let ele = renderer.create(
|
|
579
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
622
580
|
i18n: {
|
|
623
581
|
today: 'today',
|
|
624
582
|
yesterday: 'yesterday'
|
|
@@ -640,19 +598,16 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
640
598
|
key: 'tomorrow',
|
|
641
599
|
params: ['hh', 'mm', 'ss']
|
|
642
600
|
},
|
|
643
|
-
others:
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
} = _ref15;
|
|
651
|
-
|
|
601
|
+
others: ({
|
|
602
|
+
years,
|
|
603
|
+
days,
|
|
604
|
+
hours,
|
|
605
|
+
minutes,
|
|
606
|
+
suffix
|
|
607
|
+
}) => {
|
|
652
608
|
if (days > 7) {
|
|
653
609
|
return 'DD-MM-YYYY';
|
|
654
610
|
}
|
|
655
|
-
|
|
656
611
|
return '[less 7] DD-MM-YYYY';
|
|
657
612
|
},
|
|
658
613
|
ago: "ago",
|
|
@@ -662,7 +617,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
662
617
|
expect(tree).toMatchSnapshot();
|
|
663
618
|
});
|
|
664
619
|
it('Should display others', () => {
|
|
665
|
-
let ele = renderer.create(
|
|
620
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
666
621
|
i18n: {
|
|
667
622
|
today: 'today',
|
|
668
623
|
yesterday: 'yesterday'
|
|
@@ -684,20 +639,17 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
684
639
|
key: 'tomorrow',
|
|
685
640
|
params: ['hh', 'mm', 'ss']
|
|
686
641
|
},
|
|
687
|
-
others:
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
} = _ref16;
|
|
696
|
-
|
|
642
|
+
others: ({
|
|
643
|
+
years,
|
|
644
|
+
days,
|
|
645
|
+
hours,
|
|
646
|
+
minutes,
|
|
647
|
+
suffix,
|
|
648
|
+
isWithInAWeek
|
|
649
|
+
}) => {
|
|
697
650
|
if (days > 7) {
|
|
698
651
|
return 'DD-MM-YYYY';
|
|
699
652
|
}
|
|
700
|
-
|
|
701
653
|
return '[less 7] DD-MM-YYYY';
|
|
702
654
|
},
|
|
703
655
|
ago: "ago",
|
|
@@ -708,7 +660,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
708
660
|
});
|
|
709
661
|
it('Should display today1', () => {
|
|
710
662
|
let toDates = ['2016-10-24T05:55:28.000Z', '2016-10-24T06:55:28.000Z', '2016-10-24T04:55:28.000Z', '2016-10-25T05:55:28.000Z', '2016-10-25T04:55:28.000Z', '2016-10-25T06:55:28.000Z', '2016-10-26T05:55:28.000Z', '2016-10-26T04:55:28.000Z', '2016-10-26T06:55:28.000Z', '2016-10-23T05:55:28.000Z', '2016-10-23T04:55:28.000Z', '2016-10-23T06:55:28.000Z'];
|
|
711
|
-
let ele = renderer.create(
|
|
663
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
712
664
|
i18n: {
|
|
713
665
|
today: 'today',
|
|
714
666
|
yesterday: 'yesterday',
|
|
@@ -724,14 +676,12 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
724
676
|
fromTzData: fromTzData,
|
|
725
677
|
to: to,
|
|
726
678
|
toTzData: toTzData,
|
|
727
|
-
format: (
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
} = _ref17;
|
|
734
|
-
|
|
679
|
+
format: ({
|
|
680
|
+
years,
|
|
681
|
+
days,
|
|
682
|
+
months,
|
|
683
|
+
hours
|
|
684
|
+
}, pattern) => {
|
|
735
685
|
switch (pattern) {
|
|
736
686
|
case '000000':
|
|
737
687
|
case '000001':
|
|
@@ -740,27 +690,23 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
740
690
|
key: 'now'
|
|
741
691
|
};
|
|
742
692
|
break;
|
|
743
|
-
|
|
744
693
|
case '000010':
|
|
745
694
|
return {
|
|
746
695
|
key: 'support.1min'
|
|
747
696
|
};
|
|
748
697
|
break;
|
|
749
|
-
|
|
750
698
|
case '000020':
|
|
751
699
|
return {
|
|
752
700
|
key: 'support.nmins',
|
|
753
701
|
params: ['m']
|
|
754
702
|
};
|
|
755
703
|
break;
|
|
756
|
-
|
|
757
704
|
case '001000':
|
|
758
705
|
case '001100':
|
|
759
706
|
return {
|
|
760
707
|
key: 'support.1day'
|
|
761
708
|
};
|
|
762
709
|
break;
|
|
763
|
-
|
|
764
710
|
case '001200':
|
|
765
711
|
case '001201':
|
|
766
712
|
return {
|
|
@@ -777,7 +723,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
777
723
|
expect(tree).toMatchSnapshot();
|
|
778
724
|
});
|
|
779
725
|
it('Should display today later', () => {
|
|
780
|
-
let ele = renderer.create(
|
|
726
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
781
727
|
i18n: {
|
|
782
728
|
today: 'today',
|
|
783
729
|
yesterday: 'yesterday',
|
|
@@ -800,18 +746,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
800
746
|
key: 'tomorrow',
|
|
801
747
|
params: ['hh', 'mm', 'ss']
|
|
802
748
|
},
|
|
803
|
-
others:
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
} = _ref18;
|
|
810
|
-
|
|
749
|
+
others: ({
|
|
750
|
+
years,
|
|
751
|
+
days,
|
|
752
|
+
hours,
|
|
753
|
+
minutes
|
|
754
|
+
}) => {
|
|
811
755
|
if (days > 7) {
|
|
812
756
|
return 'DD-MM-YYYY';
|
|
813
757
|
}
|
|
814
|
-
|
|
815
758
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
816
759
|
},
|
|
817
760
|
ago: "ago",
|
|
@@ -821,7 +764,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
821
764
|
expect(tree).toMatchSnapshot();
|
|
822
765
|
});
|
|
823
766
|
it('Should display today ago', () => {
|
|
824
|
-
let ele = renderer.create(
|
|
767
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
825
768
|
i18n: {
|
|
826
769
|
today: 'today',
|
|
827
770
|
yesterday: 'yesterday',
|
|
@@ -845,18 +788,15 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
845
788
|
key: 'tomorrow',
|
|
846
789
|
params: ['hh', 'mm', 'ss']
|
|
847
790
|
},
|
|
848
|
-
others:
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
} = _ref19;
|
|
855
|
-
|
|
791
|
+
others: ({
|
|
792
|
+
years,
|
|
793
|
+
days,
|
|
794
|
+
hours,
|
|
795
|
+
minutes
|
|
796
|
+
}) => {
|
|
856
797
|
if (days > 7) {
|
|
857
798
|
return 'DD-MM-YYYY';
|
|
858
799
|
}
|
|
859
|
-
|
|
860
800
|
return getDateKeyWithParam(years, days, hours, minutes);
|
|
861
801
|
},
|
|
862
802
|
ago: "ago",
|
|
@@ -866,7 +806,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
866
806
|
expect(tree).toMatchSnapshot();
|
|
867
807
|
});
|
|
868
808
|
it('Should display years and days', () => {
|
|
869
|
-
let ele = renderer.create(
|
|
809
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
870
810
|
i18n: {
|
|
871
811
|
'nyear.ndays.ago': '{0} years {1} days ago',
|
|
872
812
|
yesterday: 'yesterday'
|
|
@@ -876,14 +816,12 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
876
816
|
fromTzData: fromTzData,
|
|
877
817
|
to: "2015-08-25T05:55:28.000Z",
|
|
878
818
|
toTzData: toTzData,
|
|
879
|
-
format: (
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
} = _ref20;
|
|
886
|
-
|
|
819
|
+
format: ({
|
|
820
|
+
years,
|
|
821
|
+
days,
|
|
822
|
+
months,
|
|
823
|
+
hours
|
|
824
|
+
}, pattern) => {
|
|
887
825
|
if (years > 1) {
|
|
888
826
|
return {
|
|
889
827
|
key: 'nyear.ndays',
|
|
@@ -898,7 +836,7 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
898
836
|
expect(tree).toMatchSnapshot();
|
|
899
837
|
});
|
|
900
838
|
it('Should display years and days1', () => {
|
|
901
|
-
let ele = renderer.create(
|
|
839
|
+
let ele = renderer.create(/*#__PURE__*/React.createElement(I18NProvider, {
|
|
902
840
|
i18n: {
|
|
903
841
|
'nyear.ndays.later': '{0} years {1} days later',
|
|
904
842
|
yesterday: 'yesterday'
|
|
@@ -908,14 +846,12 @@ describe('DateTimeDiffFormat component', () => {
|
|
|
908
846
|
fromTzData: fromTzData,
|
|
909
847
|
to: "2017-10-25T05:55:28.000Z",
|
|
910
848
|
toTzData: toTzData,
|
|
911
|
-
format: (
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
} = _ref21;
|
|
918
|
-
|
|
849
|
+
format: ({
|
|
850
|
+
years,
|
|
851
|
+
days,
|
|
852
|
+
months,
|
|
853
|
+
hours
|
|
854
|
+
}, pattern) => {
|
|
919
855
|
if (years > 1) {
|
|
920
856
|
return {
|
|
921
857
|
key: 'nyear.ndays',
|