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

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 (67) hide show
  1. package/README.md +73 -41
  2. package/es/components/DateTimeDiffFormat.js +46 -12
  3. package/es/components/HOCI18N.js +33 -30
  4. package/es/components/I18NProvider.js +7 -16
  5. package/es/components/UserTimeDiffFormat.js +11 -9
  6. package/es/components/__tests__/DateTimeDiffFormat.spec.js +177 -136
  7. package/es/components/__tests__/FormatText.spec.js +0 -1
  8. package/es/components/__tests__/HOCI18N.spec.js +0 -1
  9. package/es/components/__tests__/I18N.spec.js +0 -2
  10. package/es/components/__tests__/I18NProvider.spec.js +0 -1
  11. package/es/components/__tests__/PluralFormat.spec.js +0 -1
  12. package/es/components/__tests__/UserTimeDiffFormat.spec.js +287 -206
  13. package/es/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  14. package/es/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  15. package/es/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  16. package/es/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  17. package/es/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  18. package/es/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  19. package/es/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  20. package/es/index.js +2 -3
  21. package/es/utils.js +119 -171
  22. package/lib/components/DateTimeDiffFormat.js +49 -15
  23. package/lib/components/FormatText.js +4 -4
  24. package/lib/components/HOCI18N.js +4 -4
  25. package/lib/components/I18N.js +4 -4
  26. package/lib/components/I18NProvider.js +12 -21
  27. package/lib/components/PluralFormat.js +4 -4
  28. package/lib/components/UserTimeDiffFormat.js +12 -14
  29. package/lib/components/__tests__/I18NProvider.spec.js +1 -1
  30. package/lib/components/__tests__/UserTimeDiffFormat.spec.js +1 -1
  31. package/lib/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  32. package/lib/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  33. package/lib/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  34. package/lib/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  35. package/lib/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  36. package/lib/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  37. package/lib/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  38. package/lib/index.js +54 -56
  39. package/lib/utils.js +130 -212
  40. package/package.json +28 -28
  41. package/src/I18NContext.js +2 -2
  42. package/src/components/DateTimeDiffFormat.js +254 -211
  43. package/src/components/FormatText.js +14 -14
  44. package/src/components/HOCI18N.js +37 -37
  45. package/src/components/I18N.js +72 -72
  46. package/src/components/I18NProvider.js +106 -116
  47. package/src/components/PluralFormat.js +37 -37
  48. package/src/components/UserTimeDiffFormat.js +94 -103
  49. package/src/components/__tests__/DateTimeDiffFormat.spec.js +618 -618
  50. package/src/components/__tests__/FormatText.spec.js +26 -26
  51. package/src/components/__tests__/HOCI18N.spec.js +33 -33
  52. package/src/components/__tests__/I18N.spec.js +29 -29
  53. package/src/components/__tests__/I18NProvider.spec.js +65 -65
  54. package/src/components/__tests__/PluralFormat.spec.js +27 -27
  55. package/src/components/__tests__/UserTimeDiffFormat.spec.js +1076 -1076
  56. package/src/components/__tests__/__snapshots__/DateTimeDiffFormat.spec.js.snap +258 -258
  57. package/src/components/__tests__/__snapshots__/FormatText.spec.js.snap +17 -17
  58. package/src/components/__tests__/__snapshots__/HOCI18N.spec.js.snap +15 -15
  59. package/src/components/__tests__/__snapshots__/I18N.spec.js.snap +17 -17
  60. package/src/components/__tests__/__snapshots__/I18NProvider.spec.js.snap +13 -13
  61. package/src/components/__tests__/__snapshots__/PluralFormat.spec.js.snap +17 -17
  62. package/src/components/__tests__/__snapshots__/UserTimeDiffFormat.spec.js.snap +366 -366
  63. package/src/index.js +33 -33
  64. package/src/utils.js +527 -587
  65. package/es/components/NewDateFormat.js +0 -53
  66. package/lib/components/NewDateFormat.js +0 -60
  67. package/src/components/NewDateFormat.js +0 -60
@@ -1,4 +1,3 @@
1
- import "core-js/modules/web.url.to-json";
2
1
  import DateTimeDiffFormat from '../DateTimeDiffFormat';
3
2
  import I18NProvider from '../I18NProvider';
4
3
  import React from 'react';
@@ -33,12 +32,14 @@ describe('DateTimeDiffFormat component', () => {
33
32
  key: 'tomorrow',
34
33
  params: ['hh', 'mm', 'ss']
35
34
  },
36
- others: ({
37
- years,
38
- days,
39
- hours,
40
- minutes
41
- }) => {
35
+ others: _ref => {
36
+ let {
37
+ years,
38
+ days,
39
+ hours,
40
+ minutes
41
+ } = _ref;
42
+
42
43
  if (days > 7) {
43
44
  return 'DD-MM-YYYY';
44
45
  }
@@ -74,12 +75,14 @@ describe('DateTimeDiffFormat component', () => {
74
75
  key: 'tomorrow',
75
76
  params: ['hh', 'mm', 'ss']
76
77
  },
77
- others: ({
78
- years,
79
- days,
80
- hours,
81
- minutes
82
- }) => {
78
+ others: _ref2 => {
79
+ let {
80
+ years,
81
+ days,
82
+ hours,
83
+ minutes
84
+ } = _ref2;
85
+
83
86
  if (days > 7) {
84
87
  return 'DD-MM-YYYY';
85
88
  }
@@ -115,12 +118,14 @@ describe('DateTimeDiffFormat component', () => {
115
118
  key: 'tomorrow',
116
119
  params: ['hh', 'mm', 'ss']
117
120
  },
118
- others: ({
119
- years,
120
- days,
121
- hours,
122
- minutes
123
- }) => {
121
+ others: _ref3 => {
122
+ let {
123
+ years,
124
+ days,
125
+ hours,
126
+ minutes
127
+ } = _ref3;
128
+
124
129
  if (days > 7) {
125
130
  return 'DD-MM-YYYY';
126
131
  }
@@ -156,12 +161,14 @@ describe('DateTimeDiffFormat component', () => {
156
161
  key: 'tomorrow',
157
162
  params: ['hh', 'mm', 'ss']
158
163
  },
159
- others: ({
160
- years,
161
- days,
162
- hours,
163
- minutes
164
- }) => {
164
+ others: _ref4 => {
165
+ let {
166
+ years,
167
+ days,
168
+ hours,
169
+ minutes
170
+ } = _ref4;
171
+
165
172
  if (days > 7) {
166
173
  return 'DD-MM-YYYY';
167
174
  }
@@ -197,12 +204,14 @@ describe('DateTimeDiffFormat component', () => {
197
204
  key: 'tomorrow',
198
205
  params: ['hh', 'mm', 'ss']
199
206
  },
200
- others: ({
201
- years,
202
- days,
203
- hours,
204
- minutes
205
- }) => {
207
+ others: _ref5 => {
208
+ let {
209
+ years,
210
+ days,
211
+ hours,
212
+ minutes
213
+ } = _ref5;
214
+
206
215
  if (days > 7) {
207
216
  return 'DD-MM-YYYY';
208
217
  }
@@ -238,12 +247,14 @@ describe('DateTimeDiffFormat component', () => {
238
247
  key: 'tomorrow',
239
248
  params: ['hh', 'mm', 'ss']
240
249
  },
241
- others: ({
242
- years,
243
- days,
244
- hours,
245
- minutes
246
- }) => {
250
+ others: _ref6 => {
251
+ let {
252
+ years,
253
+ days,
254
+ hours,
255
+ minutes
256
+ } = _ref6;
257
+
247
258
  if (days > 7) {
248
259
  return 'DD-MM-YYYY';
249
260
  }
@@ -279,12 +290,14 @@ describe('DateTimeDiffFormat component', () => {
279
290
  key: 'tomorrow',
280
291
  params: ['hh', 'mm', 'ss']
281
292
  },
282
- others: ({
283
- years,
284
- days,
285
- hours,
286
- minutes
287
- }) => {
293
+ others: _ref7 => {
294
+ let {
295
+ years,
296
+ days,
297
+ hours,
298
+ minutes
299
+ } = _ref7;
300
+
288
301
  if (days > 7) {
289
302
  return 'DD-MM-YYYY';
290
303
  }
@@ -320,12 +333,14 @@ describe('DateTimeDiffFormat component', () => {
320
333
  key: 'tomorrow',
321
334
  params: ['hh', 'mm', 'ss']
322
335
  },
323
- others: ({
324
- years,
325
- days,
326
- hours,
327
- minutes
328
- }) => {
336
+ others: _ref8 => {
337
+ let {
338
+ years,
339
+ days,
340
+ hours,
341
+ minutes
342
+ } = _ref8;
343
+
329
344
  if (days > 7) {
330
345
  return 'DD-MM-YYYY';
331
346
  }
@@ -361,12 +376,14 @@ describe('DateTimeDiffFormat component', () => {
361
376
  key: 'tomorrow',
362
377
  params: ['hh', 'mm', 'ss']
363
378
  },
364
- others: ({
365
- years,
366
- days,
367
- hours,
368
- minutes
369
- }) => {
379
+ others: _ref9 => {
380
+ let {
381
+ years,
382
+ days,
383
+ hours,
384
+ minutes
385
+ } = _ref9;
386
+
370
387
  if (days > 7) {
371
388
  return 'DD-MM-YYYY';
372
389
  }
@@ -402,13 +419,15 @@ describe('DateTimeDiffFormat component', () => {
402
419
  key: 'tomorrow',
403
420
  params: ['hh', 'mm', 'ss']
404
421
  },
405
- others: ({
406
- years,
407
- days,
408
- hours,
409
- minutes,
410
- suffix
411
- }) => {
422
+ others: _ref10 => {
423
+ let {
424
+ years,
425
+ days,
426
+ hours,
427
+ minutes,
428
+ suffix
429
+ } = _ref10;
430
+
412
431
  if (days > 7) {
413
432
  return 'DD-MM-YYYY';
414
433
  }
@@ -444,13 +463,15 @@ describe('DateTimeDiffFormat component', () => {
444
463
  key: 'tomorrow',
445
464
  params: ['hh', 'mm', 'ss']
446
465
  },
447
- others: ({
448
- years,
449
- days,
450
- hours,
451
- minutes,
452
- suffix
453
- }) => {
466
+ others: _ref11 => {
467
+ let {
468
+ years,
469
+ days,
470
+ hours,
471
+ minutes,
472
+ suffix
473
+ } = _ref11;
474
+
454
475
  if (days > 7) {
455
476
  return 'DD-MM-YYYY';
456
477
  }
@@ -486,13 +507,15 @@ describe('DateTimeDiffFormat component', () => {
486
507
  key: 'tomorrow',
487
508
  params: ['hh', 'mm', 'ss']
488
509
  },
489
- others: ({
490
- years,
491
- days,
492
- hours,
493
- minutes,
494
- suffix
495
- }) => {
510
+ others: _ref12 => {
511
+ let {
512
+ years,
513
+ days,
514
+ hours,
515
+ minutes,
516
+ suffix
517
+ } = _ref12;
518
+
496
519
  if (days > 7) {
497
520
  return 'DD-MM-YYYY';
498
521
  }
@@ -528,14 +551,16 @@ describe('DateTimeDiffFormat component', () => {
528
551
  key: 'tomorrow',
529
552
  params: ['hh', 'mm', 'ss']
530
553
  },
531
- others: ({
532
- years,
533
- days,
534
- hours,
535
- minutes,
536
- suffix,
537
- isWithInAWeek
538
- }) => {
554
+ others: _ref13 => {
555
+ let {
556
+ years,
557
+ days,
558
+ hours,
559
+ minutes,
560
+ suffix,
561
+ isWithInAWeek
562
+ } = _ref13;
563
+
539
564
  if (days > 7) {
540
565
  return 'DD-MM-YYYY';
541
566
  }
@@ -571,13 +596,15 @@ describe('DateTimeDiffFormat component', () => {
571
596
  key: 'tomorrow',
572
597
  params: ['hh', 'mm', 'ss']
573
598
  },
574
- others: ({
575
- years,
576
- days,
577
- hours,
578
- minutes,
579
- suffix
580
- }) => {
599
+ others: _ref14 => {
600
+ let {
601
+ years,
602
+ days,
603
+ hours,
604
+ minutes,
605
+ suffix
606
+ } = _ref14;
607
+
581
608
  if (days > 7) {
582
609
  return 'DD-MM-YYYY';
583
610
  }
@@ -613,13 +640,15 @@ describe('DateTimeDiffFormat component', () => {
613
640
  key: 'tomorrow',
614
641
  params: ['hh', 'mm', 'ss']
615
642
  },
616
- others: ({
617
- years,
618
- days,
619
- hours,
620
- minutes,
621
- suffix
622
- }) => {
643
+ others: _ref15 => {
644
+ let {
645
+ years,
646
+ days,
647
+ hours,
648
+ minutes,
649
+ suffix
650
+ } = _ref15;
651
+
623
652
  if (days > 7) {
624
653
  return 'DD-MM-YYYY';
625
654
  }
@@ -655,14 +684,16 @@ describe('DateTimeDiffFormat component', () => {
655
684
  key: 'tomorrow',
656
685
  params: ['hh', 'mm', 'ss']
657
686
  },
658
- others: ({
659
- years,
660
- days,
661
- hours,
662
- minutes,
663
- suffix,
664
- isWithInAWeek
665
- }) => {
687
+ others: _ref16 => {
688
+ let {
689
+ years,
690
+ days,
691
+ hours,
692
+ minutes,
693
+ suffix,
694
+ isWithInAWeek
695
+ } = _ref16;
696
+
666
697
  if (days > 7) {
667
698
  return 'DD-MM-YYYY';
668
699
  }
@@ -693,12 +724,14 @@ describe('DateTimeDiffFormat component', () => {
693
724
  fromTzData: fromTzData,
694
725
  to: to,
695
726
  toTzData: toTzData,
696
- format: ({
697
- years,
698
- days,
699
- months,
700
- hours
701
- }, pattern) => {
727
+ format: (_ref17, pattern) => {
728
+ let {
729
+ years,
730
+ days,
731
+ months,
732
+ hours
733
+ } = _ref17;
734
+
702
735
  switch (pattern) {
703
736
  case '000000':
704
737
  case '000001':
@@ -767,12 +800,14 @@ describe('DateTimeDiffFormat component', () => {
767
800
  key: 'tomorrow',
768
801
  params: ['hh', 'mm', 'ss']
769
802
  },
770
- others: ({
771
- years,
772
- days,
773
- hours,
774
- minutes
775
- }) => {
803
+ others: _ref18 => {
804
+ let {
805
+ years,
806
+ days,
807
+ hours,
808
+ minutes
809
+ } = _ref18;
810
+
776
811
  if (days > 7) {
777
812
  return 'DD-MM-YYYY';
778
813
  }
@@ -810,12 +845,14 @@ describe('DateTimeDiffFormat component', () => {
810
845
  key: 'tomorrow',
811
846
  params: ['hh', 'mm', 'ss']
812
847
  },
813
- others: ({
814
- years,
815
- days,
816
- hours,
817
- minutes
818
- }) => {
848
+ others: _ref19 => {
849
+ let {
850
+ years,
851
+ days,
852
+ hours,
853
+ minutes
854
+ } = _ref19;
855
+
819
856
  if (days > 7) {
820
857
  return 'DD-MM-YYYY';
821
858
  }
@@ -839,12 +876,14 @@ describe('DateTimeDiffFormat component', () => {
839
876
  fromTzData: fromTzData,
840
877
  to: "2015-08-25T05:55:28.000Z",
841
878
  toTzData: toTzData,
842
- format: ({
843
- years,
844
- days,
845
- months,
846
- hours
847
- }, pattern) => {
879
+ format: (_ref20, pattern) => {
880
+ let {
881
+ years,
882
+ days,
883
+ months,
884
+ hours
885
+ } = _ref20;
886
+
848
887
  if (years > 1) {
849
888
  return {
850
889
  key: 'nyear.ndays',
@@ -869,12 +908,14 @@ describe('DateTimeDiffFormat component', () => {
869
908
  fromTzData: fromTzData,
870
909
  to: "2017-10-25T05:55:28.000Z",
871
910
  toTzData: toTzData,
872
- format: ({
873
- years,
874
- days,
875
- months,
876
- hours
877
- }, pattern) => {
911
+ format: (_ref21, pattern) => {
912
+ let {
913
+ years,
914
+ days,
915
+ months,
916
+ hours
917
+ } = _ref21;
918
+
878
919
  if (years > 1) {
879
920
  return {
880
921
  key: 'nyear.ndays',
@@ -1,4 +1,3 @@
1
- import "core-js/modules/web.url.to-json";
2
1
  import FormatText from '../FormatText';
3
2
  import I18NProvider from '../I18NProvider';
4
3
  import React from 'react';
@@ -1,4 +1,3 @@
1
- import "core-js/modules/web.url.to-json";
2
1
  import HOCI18N from '..//HOCI18N';
3
2
  import I18NProvider from '../I18NProvider';
4
3
  import PropTypes from 'prop-types';
@@ -1,5 +1,3 @@
1
- import "core-js/modules/web.url.to-json";
2
-
3
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
2
 
5
3
  import I18N from '../I18N';
@@ -1,4 +1,3 @@
1
- import "core-js/modules/web.url.to-json";
2
1
  import I18NProvider, { i18NProviderUtils } from '../I18NProvider';
3
2
  import I18N from '../I18N';
4
3
  import React from 'react';
@@ -1,4 +1,3 @@
1
- import "core-js/modules/web.url.to-json";
2
1
  import PluralFormat from '../PluralFormat';
3
2
  import I18NProvider from '../I18NProvider';
4
3
  import FormatText from '../FormatText';