@zohodesk/i18n 1.0.0-beta.3 → 1.0.0-beta.30

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 (60) hide show
  1. package/README.md +116 -2
  2. package/es/I18NContext.js +1 -2
  3. package/es/components/DateTimeDiffFormat.js +192 -200
  4. package/es/components/FormatText.js +4 -25
  5. package/es/components/HOCI18N.js +33 -45
  6. package/es/components/I18N.js +48 -63
  7. package/es/components/I18NProvider.js +59 -85
  8. package/es/components/PluralFormat.js +29 -48
  9. package/es/components/UserTimeDiffFormat.js +65 -74
  10. package/es/components/__tests__/DateTimeDiffFormat.spec.js +868 -657
  11. package/es/components/__tests__/FormatText.spec.js +20 -17
  12. package/es/components/__tests__/HOCI18N.spec.js +18 -22
  13. package/es/components/__tests__/I18N.spec.js +20 -19
  14. package/es/components/__tests__/I18NProvider.spec.js +36 -45
  15. package/es/components/__tests__/PluralFormat.spec.js +20 -17
  16. package/es/components/__tests__/UserTimeDiffFormat.spec.js +1343 -1095
  17. package/es/index.js +2 -6
  18. package/es/utils/__tests__/jsxTranslations.spec.js +174 -0
  19. package/es/utils/index.js +592 -0
  20. package/es/utils/jsxTranslations.js +193 -0
  21. package/lib/I18NContext.js +6 -6
  22. package/lib/components/DateTimeDiffFormat.js +151 -123
  23. package/lib/components/FormatText.js +32 -22
  24. package/lib/components/HOCI18N.js +47 -23
  25. package/lib/components/I18N.js +62 -36
  26. package/lib/components/I18NProvider.js +82 -70
  27. package/lib/components/PluralFormat.js +42 -32
  28. package/lib/components/UserTimeDiffFormat.js +79 -56
  29. package/lib/components/__tests__/DateTimeDiffFormat.spec.js +815 -629
  30. package/lib/components/__tests__/FormatText.spec.js +23 -25
  31. package/lib/components/__tests__/HOCI18N.spec.js +26 -34
  32. package/lib/components/__tests__/I18N.spec.js +21 -26
  33. package/lib/components/__tests__/I18NProvider.spec.js +43 -51
  34. package/lib/components/__tests__/PluralFormat.spec.js +24 -28
  35. package/lib/components/__tests__/UserTimeDiffFormat.spec.js +1256 -1039
  36. package/lib/index.js +85 -110
  37. package/lib/utils/__tests__/jsxTranslations.spec.js +183 -0
  38. package/lib/utils/index.js +658 -0
  39. package/lib/utils/jsxTranslations.js +242 -0
  40. package/package.json +3 -2
  41. package/src/components/DateTimeDiffFormat.js +86 -55
  42. package/src/components/I18N.js +2 -0
  43. package/src/components/I18NProvider.js +34 -25
  44. package/src/components/UserTimeDiffFormat.js +24 -18
  45. package/src/index.js +7 -9
  46. package/src/utils/__tests__/jsxTranslations.spec.js +213 -0
  47. package/src/utils/index.js +632 -0
  48. package/src/utils/jsxTranslations.js +180 -0
  49. package/es/components/NewDateFormat.js +0 -50
  50. package/es/offset.js +0 -629
  51. package/es/timezones.js +0 -118
  52. package/es/utils.js +0 -621
  53. package/lib/components/NewDateFormat.js +0 -68
  54. package/lib/offset.js +0 -634
  55. package/lib/timezones.js +0 -129
  56. package/lib/utils.js +0 -651
  57. package/src/components/NewDateFormat.js +0 -60
  58. package/src/offset.js +0 -629
  59. package/src/timezones.js +0 -113
  60. package/src/utils.js +0 -648
@@ -2,882 +2,1135 @@ import UserTimeDiffFormat from '../UserTimeDiffFormat';
2
2
  import I18NProvider, { i18NProviderUtils } from '../I18NProvider';
3
3
  import React from 'react';
4
4
  import renderer from 'react-test-renderer';
5
- var temp = Date;
6
- describe('UserTimeDiffFormat component', function () {
5
+ let temp = Date;
6
+ describe('UserTimeDiffFormat component', () => {
7
7
  /* eslint-disable */
8
- beforeAll(function () {
9
- Date = function Date(a) {
8
+ beforeAll(() => {
9
+ Date = function (a) {
10
10
  if (a) {
11
11
  return new temp(a);
12
12
  }
13
+
13
14
  return new temp('2016-10-25T05:55:28.000Z');
14
15
  };
16
+
15
17
  Date.UTC = temp.UTC;
16
18
  Date.now = temp.now;
17
19
  });
18
-
19
- afterAll(function () {
20
+ afterAll(() => {
20
21
  Date = temp;
21
22
  });
22
23
  /* eslint-enable */
23
- it('Should display yesterday - with same time', function () {
24
- var ele = renderer.create(React.createElement(
25
- I18NProvider,
26
- {
27
- i18n: { today: 'today', yesterday: 'yesterday' },
28
- timeZone: 'Asia/Kolkata'
29
- },
30
- React.createElement(UserTimeDiffFormat, {
31
- to: '2016-10-24T05:55:28.000Z',
32
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
33
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
34
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
35
- others: function others(_ref) {
36
- var years = _ref.years,
37
- days = _ref.days,
38
- hours = _ref.hours,
39
- minutes = _ref.minutes;
40
- return 'DD-MM-YYYY';
41
- },
42
- ago: 'ago',
43
- later: 'later'
44
- })
45
- ));
46
- var tree = ele.toJSON();
24
+
25
+ it('Should display yesterday - with same time', () => {
26
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
27
+ i18n: {
28
+ today: 'today',
29
+ yesterday: 'yesterday'
30
+ },
31
+ timeZone: "Asia/Kolkata"
32
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
33
+ to: "2016-10-24T05:55:28.000Z",
34
+ today: {
35
+ key: 'today',
36
+ params: ['hh', 'mm', 'ss']
37
+ },
38
+ yesterday: {
39
+ key: 'yesterday',
40
+ params: ['hh', 'mm', 'ss']
41
+ },
42
+ tomorrow: {
43
+ key: 'tomorrow',
44
+ params: ['hh', 'mm', 'ss']
45
+ },
46
+ others: _ref => {
47
+ let {
48
+ years,
49
+ days,
50
+ hours,
51
+ minutes
52
+ } = _ref;
53
+ return 'DD-MM-YYYY';
54
+ },
55
+ ago: "ago",
56
+ later: "later"
57
+ })));
58
+ let tree = ele.toJSON();
47
59
  expect(tree).toMatchSnapshot();
48
60
  });
49
- it('Should display yesterday - less than 24 hour', function () {
50
- var ele = renderer.create(React.createElement(
51
- I18NProvider,
52
- {
53
- i18n: { today: 'today', yesterday: 'yesterday' },
54
- timeZone: 'Asia/Kolkata'
55
- },
56
- React.createElement(UserTimeDiffFormat, {
57
- to: '2016-10-24T06:55:28.000Z',
58
- toTimeZone: 'Asia/Kolkata',
59
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
60
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
61
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
62
- others: function others(_ref2) {
63
- var years = _ref2.years,
64
- days = _ref2.days,
65
- hours = _ref2.hours,
66
- minutes = _ref2.minutes;
67
- return 'DD-MM-YYYY';
68
- },
69
- ago: 'ago',
70
- later: 'later'
71
- })
72
- ));
73
- var tree = ele.toJSON();
61
+ it('Should display yesterday - less than 24 hour', () => {
62
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
63
+ i18n: {
64
+ today: 'today',
65
+ yesterday: 'yesterday'
66
+ },
67
+ timeZone: "Asia/Kolkata"
68
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
69
+ to: "2016-10-24T06:55:28.000Z",
70
+ toTimeZone: "Asia/Kolkata",
71
+ today: {
72
+ key: 'today',
73
+ params: ['hh', 'mm', 'ss']
74
+ },
75
+ yesterday: {
76
+ key: 'yesterday',
77
+ params: ['hh', 'mm', 'ss']
78
+ },
79
+ tomorrow: {
80
+ key: 'tomorrow',
81
+ params: ['hh', 'mm', 'ss']
82
+ },
83
+ others: _ref2 => {
84
+ let {
85
+ years,
86
+ days,
87
+ hours,
88
+ minutes
89
+ } = _ref2;
90
+ return 'DD-MM-YYYY';
91
+ },
92
+ ago: "ago",
93
+ later: "later"
94
+ })));
95
+ let tree = ele.toJSON();
74
96
  expect(tree).toMatchSnapshot();
75
97
  });
76
- it('Should display yesterday - greater than 24 hour', function () {
77
- var ele = renderer.create(React.createElement(
78
- I18NProvider,
79
- {
80
- i18n: { today: 'today', yesterday: 'yesterday' },
81
- timeZone: 'Asia/Kolkata'
82
- },
83
- React.createElement(UserTimeDiffFormat, {
84
- to: '2016-10-24T04:55:28.000Z',
85
- toTimeZone: 'Asia/Kolkata',
86
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
87
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
88
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
89
- others: function others(_ref3) {
90
- var years = _ref3.years,
91
- days = _ref3.days,
92
- hours = _ref3.hours,
93
- minutes = _ref3.minutes;
94
- return 'DD-MM-YYYY';
95
- },
96
- ago: 'ago',
97
- later: 'later'
98
- })
99
- ));
100
- var tree = ele.toJSON();
98
+ it('Should display yesterday - greater than 24 hour', () => {
99
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
100
+ i18n: {
101
+ today: 'today',
102
+ yesterday: 'yesterday'
103
+ },
104
+ timeZone: "Asia/Kolkata"
105
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
106
+ to: "2016-10-24T04:55:28.000Z",
107
+ toTimeZone: "Asia/Kolkata",
108
+ today: {
109
+ key: 'today',
110
+ params: ['hh', 'mm', 'ss']
111
+ },
112
+ yesterday: {
113
+ key: 'yesterday',
114
+ params: ['hh', 'mm', 'ss']
115
+ },
116
+ tomorrow: {
117
+ key: 'tomorrow',
118
+ params: ['hh', 'mm', 'ss']
119
+ },
120
+ others: _ref3 => {
121
+ let {
122
+ years,
123
+ days,
124
+ hours,
125
+ minutes
126
+ } = _ref3;
127
+ return 'DD-MM-YYYY';
128
+ },
129
+ ago: "ago",
130
+ later: "later"
131
+ })));
132
+ let tree = ele.toJSON();
101
133
  expect(tree).toMatchSnapshot();
102
134
  });
103
- it('Should display today key - same time', function () {
104
- var ele = renderer.create(React.createElement(
105
- I18NProvider,
106
- {
107
- i18n: { today: 'today', yesterday: 'yesterday' },
108
- timeZone: 'Asia/Kolkata'
109
- },
110
- React.createElement(UserTimeDiffFormat, {
111
- to: '2016-10-25T05:55:28.000Z',
112
- toTimeZone: 'Asia/Kolkata',
113
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
114
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
115
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
116
- others: function others(_ref4) {
117
- var years = _ref4.years,
118
- days = _ref4.days,
119
- hours = _ref4.hours,
120
- minutes = _ref4.minutes;
121
- return 'DD-MM-YYYY';
122
- },
123
- ago: 'ago',
124
- later: 'later'
125
- })
126
- ));
127
- var tree = ele.toJSON();
135
+ it('Should display today key - same time', () => {
136
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
137
+ i18n: {
138
+ today: 'today',
139
+ yesterday: 'yesterday'
140
+ },
141
+ timeZone: "Asia/Kolkata"
142
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
143
+ to: "2016-10-25T05:55:28.000Z",
144
+ toTimeZone: "Asia/Kolkata",
145
+ today: {
146
+ key: 'today',
147
+ params: ['hh', 'mm', 'ss']
148
+ },
149
+ yesterday: {
150
+ key: 'yesterday',
151
+ params: ['hh', 'mm', 'ss']
152
+ },
153
+ tomorrow: {
154
+ key: 'tomorrow',
155
+ params: ['hh', 'mm', 'ss']
156
+ },
157
+ others: _ref4 => {
158
+ let {
159
+ years,
160
+ days,
161
+ hours,
162
+ minutes
163
+ } = _ref4;
164
+ return 'DD-MM-YYYY';
165
+ },
166
+ ago: "ago",
167
+ later: "later"
168
+ })));
169
+ let tree = ele.toJSON();
128
170
  expect(tree).toMatchSnapshot();
129
171
  });
130
-
131
- it('Should display today key - less than 24 hour', function () {
132
- var ele = renderer.create(React.createElement(
133
- I18NProvider,
134
- {
135
- i18n: { today: 'today', yesterday: 'yesterday' },
136
- timeZone: 'Asia/Kolkata'
137
- },
138
- React.createElement(UserTimeDiffFormat, {
139
- to: '2016-10-25T04:55:28.000Z',
140
- toTimeZone: 'Asia/Kolkata',
141
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
142
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
143
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
144
- others: function others(_ref5) {
145
- var years = _ref5.years,
146
- days = _ref5.days,
147
- hours = _ref5.hours,
148
- minutes = _ref5.minutes;
149
- return 'DD-MM-YYYY';
150
- },
151
- ago: 'ago',
152
- later: 'later'
153
- })
154
- ));
155
- var tree = ele.toJSON();
172
+ it('Should display today key - less than 24 hour', () => {
173
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
174
+ i18n: {
175
+ today: 'today',
176
+ yesterday: 'yesterday'
177
+ },
178
+ timeZone: "Asia/Kolkata"
179
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
180
+ to: "2016-10-25T04:55:28.000Z",
181
+ toTimeZone: "Asia/Kolkata",
182
+ today: {
183
+ key: 'today',
184
+ params: ['hh', 'mm', 'ss']
185
+ },
186
+ yesterday: {
187
+ key: 'yesterday',
188
+ params: ['hh', 'mm', 'ss']
189
+ },
190
+ tomorrow: {
191
+ key: 'tomorrow',
192
+ params: ['hh', 'mm', 'ss']
193
+ },
194
+ others: _ref5 => {
195
+ let {
196
+ years,
197
+ days,
198
+ hours,
199
+ minutes
200
+ } = _ref5;
201
+ return 'DD-MM-YYYY';
202
+ },
203
+ ago: "ago",
204
+ later: "later"
205
+ })));
206
+ let tree = ele.toJSON();
156
207
  expect(tree).toMatchSnapshot();
157
208
  });
158
- it('Should display today key - greater than 24 hour', function () {
159
- var ele = renderer.create(React.createElement(
160
- I18NProvider,
161
- {
162
- i18n: { today: 'today', yesterday: 'yesterday' },
163
- timeZone: 'Asia/Kolkata'
164
- },
165
- React.createElement(UserTimeDiffFormat, {
166
- to: '2016-10-25T06:55:28.000Z',
167
- toTimeZone: 'Asia/Kolkata',
168
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
169
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
170
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
171
- others: function others(_ref6) {
172
- var years = _ref6.years,
173
- days = _ref6.days,
174
- hours = _ref6.hours,
175
- minutes = _ref6.minutes;
176
- return 'DD-MM-YYYY';
177
- },
178
- ago: 'ago',
179
- later: 'later'
180
- })
181
- ));
182
- var tree = ele.toJSON();
209
+ it('Should display today key - greater than 24 hour', () => {
210
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
211
+ i18n: {
212
+ today: 'today',
213
+ yesterday: 'yesterday'
214
+ },
215
+ timeZone: "Asia/Kolkata"
216
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
217
+ to: "2016-10-25T06:55:28.000Z",
218
+ toTimeZone: "Asia/Kolkata",
219
+ today: {
220
+ key: 'today',
221
+ params: ['hh', 'mm', 'ss']
222
+ },
223
+ yesterday: {
224
+ key: 'yesterday',
225
+ params: ['hh', 'mm', 'ss']
226
+ },
227
+ tomorrow: {
228
+ key: 'tomorrow',
229
+ params: ['hh', 'mm', 'ss']
230
+ },
231
+ others: _ref6 => {
232
+ let {
233
+ years,
234
+ days,
235
+ hours,
236
+ minutes
237
+ } = _ref6;
238
+ return 'DD-MM-YYYY';
239
+ },
240
+ ago: "ago",
241
+ later: "later"
242
+ })));
243
+ let tree = ele.toJSON();
183
244
  expect(tree).toMatchSnapshot();
184
245
  });
185
- it('Should display tomorrow key - same time', function () {
186
- var ele = renderer.create(React.createElement(
187
- I18NProvider,
188
- {
189
- i18n: { today: 'today', yesterday: 'yesterday' },
190
- timeZone: 'Asia/Kolkata'
191
- },
192
- React.createElement(UserTimeDiffFormat, {
193
- to: '2016-10-26T05:55:28.000Z',
194
- toTimeZone: 'Asia/Kolkata',
195
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
196
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
197
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
198
- others: function others(_ref7) {
199
- var years = _ref7.years,
200
- days = _ref7.days,
201
- hours = _ref7.hours,
202
- minutes = _ref7.minutes;
203
- return 'DD-MM-YYYY';
204
- },
205
- ago: 'ago',
206
- later: 'later'
207
- })
208
- ));
209
- var tree = ele.toJSON();
246
+ it('Should display tomorrow key - same time', () => {
247
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
248
+ i18n: {
249
+ today: 'today',
250
+ yesterday: 'yesterday'
251
+ },
252
+ timeZone: "Asia/Kolkata"
253
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
254
+ to: "2016-10-26T05:55:28.000Z",
255
+ toTimeZone: "Asia/Kolkata",
256
+ today: {
257
+ key: 'today',
258
+ params: ['hh', 'mm', 'ss']
259
+ },
260
+ yesterday: {
261
+ key: 'yesterday',
262
+ params: ['hh', 'mm', 'ss']
263
+ },
264
+ tomorrow: {
265
+ key: 'tomorrow',
266
+ params: ['hh', 'mm', 'ss']
267
+ },
268
+ others: _ref7 => {
269
+ let {
270
+ years,
271
+ days,
272
+ hours,
273
+ minutes
274
+ } = _ref7;
275
+ return 'DD-MM-YYYY';
276
+ },
277
+ ago: "ago",
278
+ later: "later"
279
+ })));
280
+ let tree = ele.toJSON();
210
281
  expect(tree).toMatchSnapshot();
211
282
  });
212
- it('Should display tomorrow key - less than 24 hour', function () {
213
- var ele = renderer.create(React.createElement(
214
- I18NProvider,
215
- {
216
- i18n: { today: 'today', yesterday: 'yesterday' },
217
- timeZone: 'Asia/Kolkata'
218
- },
219
- React.createElement(UserTimeDiffFormat, {
220
- to: '2016-10-26T04:55:28.000Z',
221
- toTimeZone: 'Asia/Kolkata',
222
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
223
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
224
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
225
- others: function others(_ref8) {
226
- var years = _ref8.years,
227
- days = _ref8.days,
228
- hours = _ref8.hours,
229
- minutes = _ref8.minutes;
230
- return 'DD-MM-YYYY';
231
- },
232
- ago: 'ago',
233
- later: 'later'
234
- })
235
- ));
236
- var tree = ele.toJSON();
283
+ it('Should display tomorrow key - less than 24 hour', () => {
284
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
285
+ i18n: {
286
+ today: 'today',
287
+ yesterday: 'yesterday'
288
+ },
289
+ timeZone: "Asia/Kolkata"
290
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
291
+ to: "2016-10-26T04:55:28.000Z",
292
+ toTimeZone: "Asia/Kolkata",
293
+ today: {
294
+ key: 'today',
295
+ params: ['hh', 'mm', 'ss']
296
+ },
297
+ yesterday: {
298
+ key: 'yesterday',
299
+ params: ['hh', 'mm', 'ss']
300
+ },
301
+ tomorrow: {
302
+ key: 'tomorrow',
303
+ params: ['hh', 'mm', 'ss']
304
+ },
305
+ others: _ref8 => {
306
+ let {
307
+ years,
308
+ days,
309
+ hours,
310
+ minutes
311
+ } = _ref8;
312
+ return 'DD-MM-YYYY';
313
+ },
314
+ ago: "ago",
315
+ later: "later"
316
+ })));
317
+ let tree = ele.toJSON();
237
318
  expect(tree).toMatchSnapshot();
238
319
  });
239
- it('Should display tomorrow key - greater than 24 hour', function () {
240
- var ele = renderer.create(React.createElement(
241
- I18NProvider,
242
- {
243
- i18n: { today: 'today', yesterday: 'yesterday' },
244
- timeZone: 'Asia/Kolkata'
245
- },
246
- React.createElement(UserTimeDiffFormat, {
247
- to: '2016-10-26T06:55:28.000Z',
248
- toTimeZone: 'Asia/Kolkata',
249
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
250
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
251
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
252
- others: function others(_ref9) {
253
- var years = _ref9.years,
254
- days = _ref9.days,
255
- hours = _ref9.hours,
256
- minutes = _ref9.minutes;
257
- return 'DD-MM-YYYY';
258
- },
259
- ago: 'ago',
260
- later: 'later'
261
- })
262
- ));
263
- var tree = ele.toJSON();
320
+ it('Should display tomorrow key - greater than 24 hour', () => {
321
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
322
+ i18n: {
323
+ today: 'today',
324
+ yesterday: 'yesterday'
325
+ },
326
+ timeZone: "Asia/Kolkata"
327
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
328
+ to: "2016-10-26T06:55:28.000Z",
329
+ toTimeZone: "Asia/Kolkata",
330
+ today: {
331
+ key: 'today',
332
+ params: ['hh', 'mm', 'ss']
333
+ },
334
+ yesterday: {
335
+ key: 'yesterday',
336
+ params: ['hh', 'mm', 'ss']
337
+ },
338
+ tomorrow: {
339
+ key: 'tomorrow',
340
+ params: ['hh', 'mm', 'ss']
341
+ },
342
+ others: _ref9 => {
343
+ let {
344
+ years,
345
+ days,
346
+ hours,
347
+ minutes
348
+ } = _ref9;
349
+ return 'DD-MM-YYYY';
350
+ },
351
+ ago: "ago",
352
+ later: "later"
353
+ })));
354
+ let tree = ele.toJSON();
264
355
  expect(tree).toMatchSnapshot();
265
356
  });
266
- it('Should display other - same time', function () {
267
- var ele = renderer.create(React.createElement(
268
- I18NProvider,
269
- {
270
- i18n: { today: 'today', yesterday: 'yesterday' },
271
- timeZone: 'Asia/Kolkata'
272
- },
273
- React.createElement(UserTimeDiffFormat, {
274
- to: '2016-10-23T05:55:28.000Z',
275
- toTimeZone: 'Asia/Kolkata',
276
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
277
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
278
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
279
- others: function others(_ref10) {
280
- var years = _ref10.years,
281
- days = _ref10.days,
282
- hours = _ref10.hours,
283
- minutes = _ref10.minutes,
284
- suffix = _ref10.suffix;
357
+ it('Should display other - same time', () => {
358
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
359
+ i18n: {
360
+ today: 'today',
361
+ yesterday: 'yesterday'
362
+ },
363
+ timeZone: "Asia/Kolkata"
364
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
365
+ to: "2016-10-23T05:55:28.000Z",
366
+ toTimeZone: "Asia/Kolkata",
367
+ today: {
368
+ key: 'today',
369
+ params: ['hh', 'mm', 'ss']
370
+ },
371
+ yesterday: {
372
+ key: 'yesterday',
373
+ params: ['hh', 'mm', 'ss']
374
+ },
375
+ tomorrow: {
376
+ key: 'tomorrow',
377
+ params: ['hh', 'mm', 'ss']
378
+ },
379
+ others: _ref10 => {
380
+ let {
381
+ years,
382
+ days,
383
+ hours,
384
+ minutes,
385
+ suffix
386
+ } = _ref10;
285
387
 
286
- if (days > 7) {
287
- return 'DD-MM-YYYY';
288
- }
289
- return '[less 7] DD-MM-YYYY';
290
- },
291
- ago: 'ago',
292
- later: 'later'
293
- })
294
- ));
295
- var tree = ele.toJSON();
388
+ if (days > 7) {
389
+ return 'DD-MM-YYYY';
390
+ }
391
+
392
+ return '[less 7] DD-MM-YYYY';
393
+ },
394
+ ago: "ago",
395
+ later: "later"
396
+ })));
397
+ let tree = ele.toJSON();
296
398
  expect(tree).toMatchSnapshot();
297
399
  });
298
- it('Should display other - greater time', function () {
299
- var ele = renderer.create(React.createElement(
300
- I18NProvider,
301
- {
302
- i18n: { today: 'today', yesterday: 'yesterday' },
303
- timeZone: 'Asia/Kolkata'
304
- },
305
- React.createElement(UserTimeDiffFormat, {
306
- to: '2016-10-23T06:55:28.000Z',
307
- toTimeZone: 'Asia/Kolkata',
308
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
309
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
310
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
311
- others: function others(_ref11) {
312
- var years = _ref11.years,
313
- days = _ref11.days,
314
- hours = _ref11.hours,
315
- minutes = _ref11.minutes,
316
- suffix = _ref11.suffix;
400
+ it('Should display other - greater time', () => {
401
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
402
+ i18n: {
403
+ today: 'today',
404
+ yesterday: 'yesterday'
405
+ },
406
+ timeZone: "Asia/Kolkata"
407
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
408
+ to: "2016-10-23T06:55:28.000Z",
409
+ toTimeZone: "Asia/Kolkata",
410
+ today: {
411
+ key: 'today',
412
+ params: ['hh', 'mm', 'ss']
413
+ },
414
+ yesterday: {
415
+ key: 'yesterday',
416
+ params: ['hh', 'mm', 'ss']
417
+ },
418
+ tomorrow: {
419
+ key: 'tomorrow',
420
+ params: ['hh', 'mm', 'ss']
421
+ },
422
+ others: _ref11 => {
423
+ let {
424
+ years,
425
+ days,
426
+ hours,
427
+ minutes,
428
+ suffix
429
+ } = _ref11;
317
430
 
318
- if (days > 7) {
319
- return 'DD-MM-YYYY';
320
- }
321
- return '[less 7] DD-MM-YYYY';
322
- },
323
- ago: 'ago',
324
- later: 'later'
325
- })
326
- ));
327
- var tree = ele.toJSON();
431
+ if (days > 7) {
432
+ return 'DD-MM-YYYY';
433
+ }
434
+
435
+ return '[less 7] DD-MM-YYYY';
436
+ },
437
+ ago: "ago",
438
+ later: "later"
439
+ })));
440
+ let tree = ele.toJSON();
328
441
  expect(tree).toMatchSnapshot();
329
442
  });
330
- it('Should display other - less time', function () {
331
- var ele = renderer.create(React.createElement(
332
- I18NProvider,
333
- {
334
- i18n: { today: 'today', yesterday: 'yesterday' },
335
- timeZone: 'Asia/Kolkata'
336
- },
337
- React.createElement(UserTimeDiffFormat, {
338
- to: '2016-10-23T04:55:28.000Z',
339
- toTimeZone: 'Asia/Kolkata',
340
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
341
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
342
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
343
- others: function others(_ref12) {
344
- var years = _ref12.years,
345
- days = _ref12.days,
346
- hours = _ref12.hours,
347
- minutes = _ref12.minutes,
348
- suffix = _ref12.suffix;
443
+ it('Should display other - less time', () => {
444
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
445
+ i18n: {
446
+ today: 'today',
447
+ yesterday: 'yesterday'
448
+ },
449
+ timeZone: "Asia/Kolkata"
450
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
451
+ to: "2016-10-23T04:55:28.000Z",
452
+ toTimeZone: "Asia/Kolkata",
453
+ today: {
454
+ key: 'today',
455
+ params: ['hh', 'mm', 'ss']
456
+ },
457
+ yesterday: {
458
+ key: 'yesterday',
459
+ params: ['hh', 'mm', 'ss']
460
+ },
461
+ tomorrow: {
462
+ key: 'tomorrow',
463
+ params: ['hh', 'mm', 'ss']
464
+ },
465
+ others: _ref12 => {
466
+ let {
467
+ years,
468
+ days,
469
+ hours,
470
+ minutes,
471
+ suffix
472
+ } = _ref12;
349
473
 
350
- if (days > 7) {
351
- return 'DD-MM-YYYY';
352
- }
353
- return '[less 7] DD-MM-YYYY';
354
- },
355
- ago: 'ago',
356
- later: 'later'
357
- })
358
- ));
359
- var tree = ele.toJSON();
474
+ if (days > 7) {
475
+ return 'DD-MM-YYYY';
476
+ }
477
+
478
+ return '[less 7] DD-MM-YYYY';
479
+ },
480
+ ago: "ago",
481
+ later: "later"
482
+ })));
483
+ let tree = ele.toJSON();
360
484
  expect(tree).toMatchSnapshot();
361
485
  });
362
- it('Should display other later- same time', function () {
363
- var ele = renderer.create(React.createElement(
364
- I18NProvider,
365
- {
366
- i18n: { today: 'today', yesterday: 'yesterday' },
367
- timeZone: 'Asia/Kolkata'
368
- },
369
- React.createElement(UserTimeDiffFormat, {
370
- to: '2016-10-27T05:55:28.000Z',
371
- toTimeZone: 'Asia/Kolkata',
372
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
373
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
374
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
375
- others: function others(_ref13) {
376
- var years = _ref13.years,
377
- days = _ref13.days,
378
- hours = _ref13.hours,
379
- minutes = _ref13.minutes,
380
- suffix = _ref13.suffix,
381
- isWithInAWeek = _ref13.isWithInAWeek;
486
+ it('Should display other later- same time', () => {
487
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
488
+ i18n: {
489
+ today: 'today',
490
+ yesterday: 'yesterday'
491
+ },
492
+ timeZone: "Asia/Kolkata"
493
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
494
+ to: "2016-10-27T05:55:28.000Z",
495
+ toTimeZone: "Asia/Kolkata",
496
+ today: {
497
+ key: 'today',
498
+ params: ['hh', 'mm', 'ss']
499
+ },
500
+ yesterday: {
501
+ key: 'yesterday',
502
+ params: ['hh', 'mm', 'ss']
503
+ },
504
+ tomorrow: {
505
+ key: 'tomorrow',
506
+ params: ['hh', 'mm', 'ss']
507
+ },
508
+ others: _ref13 => {
509
+ let {
510
+ years,
511
+ days,
512
+ hours,
513
+ minutes,
514
+ suffix,
515
+ isWithInAWeek
516
+ } = _ref13;
382
517
 
383
- if (days > 7) {
384
- return 'DD-MM-YYYY';
385
- }
386
- return '[less 7] DD-MM-YYYY';
387
- },
388
- ago: 'ago',
389
- later: 'later'
390
- })
391
- ));
392
- var tree = ele.toJSON();
518
+ if (days > 7) {
519
+ return 'DD-MM-YYYY';
520
+ }
521
+
522
+ return '[less 7] DD-MM-YYYY';
523
+ },
524
+ ago: "ago",
525
+ later: "later"
526
+ })));
527
+ let tree = ele.toJSON();
393
528
  expect(tree).toMatchSnapshot();
394
529
  });
395
- it('Should display other later- less time', function () {
396
- var ele = renderer.create(React.createElement(
397
- I18NProvider,
398
- {
399
- i18n: { today: 'today', yesterday: 'yesterday' },
400
- timeZone: 'Asia/Kolkata'
401
- },
402
- React.createElement(UserTimeDiffFormat, {
403
- to: '2016-10-27T06:55:28.000Z',
404
- toTimeZone: 'Asia/Kolkata',
405
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
406
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
407
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
408
- others: function others(_ref14) {
409
- var years = _ref14.years,
410
- days = _ref14.days,
411
- hours = _ref14.hours,
412
- minutes = _ref14.minutes,
413
- suffix = _ref14.suffix;
530
+ it('Should display other later- less time', () => {
531
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
532
+ i18n: {
533
+ today: 'today',
534
+ yesterday: 'yesterday'
535
+ },
536
+ timeZone: "Asia/Kolkata"
537
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
538
+ to: "2016-10-27T06:55:28.000Z",
539
+ toTimeZone: "Asia/Kolkata",
540
+ today: {
541
+ key: 'today',
542
+ params: ['hh', 'mm', 'ss']
543
+ },
544
+ yesterday: {
545
+ key: 'yesterday',
546
+ params: ['hh', 'mm', 'ss']
547
+ },
548
+ tomorrow: {
549
+ key: 'tomorrow',
550
+ params: ['hh', 'mm', 'ss']
551
+ },
552
+ others: _ref14 => {
553
+ let {
554
+ years,
555
+ days,
556
+ hours,
557
+ minutes,
558
+ suffix
559
+ } = _ref14;
414
560
 
415
- if (days > 7) {
416
- return 'DD-MM-YYYY';
417
- }
418
- return '[less 7] DD-MM-YYYY';
419
- },
420
- ago: 'ago',
421
- later: 'later'
422
- })
423
- ));
424
- var tree = ele.toJSON();
561
+ if (days > 7) {
562
+ return 'DD-MM-YYYY';
563
+ }
564
+
565
+ return '[less 7] DD-MM-YYYY';
566
+ },
567
+ ago: "ago",
568
+ later: "later"
569
+ })));
570
+ let tree = ele.toJSON();
425
571
  expect(tree).toMatchSnapshot();
426
572
  });
427
- it('Should display other later- less time', function () {
428
- var ele = renderer.create(React.createElement(
429
- I18NProvider,
430
- {
431
- i18n: { today: 'today', yesterday: 'yesterday' },
432
- timeZone: 'Asia/Kolkata'
433
- },
434
- React.createElement(UserTimeDiffFormat, {
435
- to: '2016-10-27T04:55:28.000Z',
436
- toTimeZone: 'Asia/Kolkata',
437
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
438
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
439
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
440
- others: function others(_ref15) {
441
- var years = _ref15.years,
442
- days = _ref15.days,
443
- hours = _ref15.hours,
444
- minutes = _ref15.minutes,
445
- suffix = _ref15.suffix;
573
+ it('Should display other later- less time', () => {
574
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
575
+ i18n: {
576
+ today: 'today',
577
+ yesterday: 'yesterday'
578
+ },
579
+ timeZone: "Asia/Kolkata"
580
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
581
+ to: "2016-10-27T04:55:28.000Z",
582
+ toTimeZone: "Asia/Kolkata",
583
+ today: {
584
+ key: 'today',
585
+ params: ['hh', 'mm', 'ss']
586
+ },
587
+ yesterday: {
588
+ key: 'yesterday',
589
+ params: ['hh', 'mm', 'ss']
590
+ },
591
+ tomorrow: {
592
+ key: 'tomorrow',
593
+ params: ['hh', 'mm', 'ss']
594
+ },
595
+ others: _ref15 => {
596
+ let {
597
+ years,
598
+ days,
599
+ hours,
600
+ minutes,
601
+ suffix
602
+ } = _ref15;
446
603
 
447
- if (days > 7) {
448
- return 'DD-MM-YYYY';
449
- }
450
- return '[less 7] DD-MM-YYYY';
451
- },
452
- ago: 'ago',
453
- later: 'later'
454
- })
455
- ));
456
- var tree = ele.toJSON();
604
+ if (days > 7) {
605
+ return 'DD-MM-YYYY';
606
+ }
607
+
608
+ return '[less 7] DD-MM-YYYY';
609
+ },
610
+ ago: "ago",
611
+ later: "later"
612
+ })));
613
+ let tree = ele.toJSON();
457
614
  expect(tree).toMatchSnapshot();
458
615
  });
459
- it('Should display others', function () {
460
- var ele = renderer.create(React.createElement(
461
- I18NProvider,
462
- {
463
- i18n: { today: 'today', yesterday: 'yesterday' },
464
- timeZone: 'Asia/Kolkata'
465
- },
466
- React.createElement(UserTimeDiffFormat, {
467
- to: '2016-11-27T05:55:28.000Z',
468
- toTimeZone: 'Asia/Kolkata',
469
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
470
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
471
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
472
- others: function others(_ref16) {
473
- var years = _ref16.years,
474
- days = _ref16.days,
475
- hours = _ref16.hours,
476
- minutes = _ref16.minutes,
477
- suffix = _ref16.suffix,
478
- isWithInAWeek = _ref16.isWithInAWeek;
616
+ it('Should display others', () => {
617
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
618
+ i18n: {
619
+ today: 'today',
620
+ yesterday: 'yesterday'
621
+ },
622
+ timeZone: "Asia/Kolkata"
623
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
624
+ to: "2016-11-27T05:55:28.000Z",
625
+ toTimeZone: "Asia/Kolkata",
626
+ today: {
627
+ key: 'today',
628
+ params: ['hh', 'mm', 'ss']
629
+ },
630
+ yesterday: {
631
+ key: 'yesterday',
632
+ params: ['hh', 'mm', 'ss']
633
+ },
634
+ tomorrow: {
635
+ key: 'tomorrow',
636
+ params: ['hh', 'mm', 'ss']
637
+ },
638
+ others: _ref16 => {
639
+ let {
640
+ years,
641
+ days,
642
+ hours,
643
+ minutes,
644
+ suffix,
645
+ isWithInAWeek
646
+ } = _ref16;
479
647
 
480
- if (days > 7) {
481
- return 'DD-MM-YYYY';
482
- }
483
- return '[less 7] DD-MM-YYYY';
484
- },
485
- ago: 'ago',
486
- later: 'later'
487
- })
488
- ));
489
- var tree = ele.toJSON();
648
+ if (days > 7) {
649
+ return 'DD-MM-YYYY';
650
+ }
651
+
652
+ return '[less 7] DD-MM-YYYY';
653
+ },
654
+ ago: "ago",
655
+ later: "later"
656
+ })));
657
+ let tree = ele.toJSON();
490
658
  expect(tree).toMatchSnapshot();
491
659
  });
660
+ it('Should display today1', () => {
661
+ 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'];
662
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
663
+ i18n: {
664
+ today: 'today',
665
+ yesterday: 'yesterday',
666
+ now: 'noooow',
667
+ 'support.1day.ago': '1day ago',
668
+ 'support.1day.nhours.ago': 'one day {0} hours ago',
669
+ 'support.1min.ago': '1min ago',
670
+ 'support.nmins.ago': '{0} mins ago'
671
+ },
672
+ timeZone: "Asia/Kolkata"
673
+ }, /*#__PURE__*/React.createElement("div", null, toDates.map((to, i) => /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
674
+ key: i,
675
+ to: to,
676
+ toTimeZone: "Asia/Kolkata",
677
+ format: (_ref17, pattern) => {
678
+ let {
679
+ years,
680
+ days,
681
+ months,
682
+ hours
683
+ } = _ref17;
492
684
 
493
- it('Should display today1', function () {
494
- var 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'];
495
- var ele = renderer.create(React.createElement(
496
- I18NProvider,
497
- {
498
- i18n: {
499
- today: 'today',
500
- yesterday: 'yesterday',
501
- now: 'noooow',
502
- 'support.1day.ago': '1day ago',
503
- 'support.1day.nhours.ago': 'one day {0} hours ago',
504
- 'support.1min.ago': '1min ago',
505
- 'support.nmins.ago': '{0} mins ago'
506
- },
507
- timeZone: 'Asia/Kolkata'
508
- },
509
- React.createElement(
510
- 'div',
511
- null,
512
- toDates.map(function (to, i) {
513
- return React.createElement(UserTimeDiffFormat, {
514
- key: i,
515
- to: to,
516
- toTimeZone: 'Asia/Kolkata',
517
- format: function format(_ref17, pattern) {
518
- var years = _ref17.years,
519
- days = _ref17.days,
520
- months = _ref17.months,
521
- hours = _ref17.hours;
685
+ switch (pattern) {
686
+ case '000000':
687
+ case '000001':
688
+ case '000002':
689
+ return {
690
+ key: 'now'
691
+ };
692
+ break;
522
693
 
523
- switch (pattern) {
524
- case '000000':
525
- case '000001':
526
- case '000002':
527
- return {
528
- key: 'now'
529
- };
530
- break;
531
- case '000010':
532
- return {
533
- key: 'support.1min'
534
- };
535
- break;
536
- case '000020':
537
- return {
538
- key: 'support.nmins',
539
- params: ['m']
540
- };
541
- break;
542
- case '001000':
543
- case '001100':
544
- return {
545
- key: 'support.1day'
546
- };
547
- break;
548
- case '001200':
549
- case '001201':
550
- return {
551
- key: 'support.1day.nhours',
552
- params: ['h']
553
- };
554
- break;
555
- }
556
- },
557
- ago: 'ago',
558
- later: 'later'
559
- });
560
- })
561
- )
562
- ));
563
- var tree = ele.toJSON();
694
+ case '000010':
695
+ return {
696
+ key: 'support.1min'
697
+ };
698
+ break;
699
+
700
+ case '000020':
701
+ return {
702
+ key: 'support.nmins',
703
+ params: ['m']
704
+ };
705
+ break;
706
+
707
+ case '001000':
708
+ case '001100':
709
+ return {
710
+ key: 'support.1day'
711
+ };
712
+ break;
713
+
714
+ case '001200':
715
+ case '001201':
716
+ return {
717
+ key: 'support.1day.nhours',
718
+ params: ['h']
719
+ };
720
+ break;
721
+ }
722
+ },
723
+ ago: "ago",
724
+ later: "later"
725
+ })))));
726
+ let tree = ele.toJSON();
564
727
  expect(tree).toMatchSnapshot();
565
728
  });
566
- it('Should display today later', function () {
567
- var ele = renderer.create(React.createElement(
568
- I18NProvider,
569
- {
570
- i18n: {
571
- today: 'today',
572
- yesterday: 'yesterday',
573
- 'today.later': '{0}:{1}:{2} later'
574
- },
575
- timeZone: 'Asia/Kolkata'
576
- },
577
- React.createElement(UserTimeDiffFormat, {
578
- to: '2016-10-25T05:55:29.000Z',
579
- toTimeZone: 'Asia/Kolkata',
580
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
581
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
582
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
583
- others: function others(_ref18) {
584
- var years = _ref18.years,
585
- days = _ref18.days,
586
- hours = _ref18.hours,
587
- minutes = _ref18.minutes;
588
- return 'DD-MM-YYYY';
589
- },
590
- ago: 'ago',
591
- later: 'later'
592
- })
593
- ));
594
- var tree = ele.toJSON();
729
+ it('Should display today later', () => {
730
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
731
+ i18n: {
732
+ today: 'today',
733
+ yesterday: 'yesterday',
734
+ 'today.later': '{0}:{1}:{2} later'
735
+ },
736
+ timeZone: "Asia/Kolkata"
737
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
738
+ to: "2016-10-25T05:55:29.000Z",
739
+ toTimeZone: "Asia/Kolkata",
740
+ today: {
741
+ key: 'today',
742
+ params: ['hh', 'mm', 'ss']
743
+ },
744
+ yesterday: {
745
+ key: 'yesterday',
746
+ params: ['hh', 'mm', 'ss']
747
+ },
748
+ tomorrow: {
749
+ key: 'tomorrow',
750
+ params: ['hh', 'mm', 'ss']
751
+ },
752
+ others: _ref18 => {
753
+ let {
754
+ years,
755
+ days,
756
+ hours,
757
+ minutes
758
+ } = _ref18;
759
+ return 'DD-MM-YYYY';
760
+ },
761
+ ago: "ago",
762
+ later: "later"
763
+ })));
764
+ let tree = ele.toJSON();
595
765
  expect(tree).toMatchSnapshot();
596
766
  });
597
- it('Should display today ago', function () {
598
- var ele = renderer.create(React.createElement(
599
- I18NProvider,
600
- {
601
- i18n: {
602
- today: 'today',
603
- yesterday: 'yesterday',
604
- 'today.later': '{0}:{1}:{2} later',
605
- 'today.ago': '{0}:{1}:{2} ago'
606
- },
607
- timeZone: 'Asia/Kolkata'
608
- },
609
- React.createElement(UserTimeDiffFormat, {
610
- from: '2016-10-25T05:55:30.000Z',
611
- to: '2016-10-25T05:55:29.000Z',
612
- toTimeZone: 'Asia/Kolkata',
613
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
614
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
615
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
616
- others: function others(_ref19) {
617
- var years = _ref19.years,
618
- days = _ref19.days,
619
- hours = _ref19.hours,
620
- minutes = _ref19.minutes;
621
- return 'DD-MM-YYYY';
622
- },
623
- ago: 'ago',
624
- later: 'later'
625
- })
626
- ));
627
- var tree = ele.toJSON();
767
+ it('Should display today ago', () => {
768
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
769
+ i18n: {
770
+ today: 'today',
771
+ yesterday: 'yesterday',
772
+ 'today.later': '{0}:{1}:{2} later',
773
+ 'today.ago': '{0}:{1}:{2} ago'
774
+ },
775
+ timeZone: "Asia/Kolkata"
776
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
777
+ from: "2016-10-25T05:55:30.000Z",
778
+ to: "2016-10-25T05:55:29.000Z",
779
+ toTimeZone: "Asia/Kolkata",
780
+ today: {
781
+ key: 'today',
782
+ params: ['hh', 'mm', 'ss']
783
+ },
784
+ yesterday: {
785
+ key: 'yesterday',
786
+ params: ['hh', 'mm', 'ss']
787
+ },
788
+ tomorrow: {
789
+ key: 'tomorrow',
790
+ params: ['hh', 'mm', 'ss']
791
+ },
792
+ others: _ref19 => {
793
+ let {
794
+ years,
795
+ days,
796
+ hours,
797
+ minutes
798
+ } = _ref19;
799
+ return 'DD-MM-YYYY';
800
+ },
801
+ ago: "ago",
802
+ later: "later"
803
+ })));
804
+ let tree = ele.toJSON();
628
805
  expect(tree).toMatchSnapshot();
629
806
  });
630
- it('Should display years and days', function () {
631
- var ele = renderer.create(React.createElement(
632
- I18NProvider,
633
- {
634
- i18n: {
635
- 'nyear.ndays.ago': '{0} years {1} days ago',
636
- yesterday: 'yesterday'
637
- },
638
- timeZone: 'Asia/Kolkata'
639
- },
640
- React.createElement(UserTimeDiffFormat, {
641
- from: '2017-10-25T05:55:28.000Z',
642
- to: '2015-08-25T05:55:28.000Z',
643
- toTimeZone: 'Asia/Kolkata',
644
- format: function format(_ref20, pattern) {
645
- var years = _ref20.years,
646
- days = _ref20.days,
647
- months = _ref20.months,
648
- hours = _ref20.hours;
807
+ it('Should display years and days', () => {
808
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
809
+ i18n: {
810
+ 'nyear.ndays.ago': '{0} years {1} days ago',
811
+ yesterday: 'yesterday'
812
+ },
813
+ timeZone: "Asia/Kolkata"
814
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
815
+ from: "2017-10-25T05:55:28.000Z",
816
+ to: "2015-08-25T05:55:28.000Z",
817
+ toTimeZone: "Asia/Kolkata",
818
+ format: (_ref20, pattern) => {
819
+ let {
820
+ years,
821
+ days,
822
+ months,
823
+ hours
824
+ } = _ref20;
649
825
 
650
- if (years > 1) {
651
- return {
652
- key: 'nyear.ndays',
653
- params: ['y', 'days']
654
- };
655
- }
656
- },
657
- ago: 'ago',
658
- later: 'later'
659
- })
660
- ));
661
- var tree = ele.toJSON();
826
+ if (years > 1) {
827
+ return {
828
+ key: 'nyear.ndays',
829
+ params: ['y', 'days']
830
+ };
831
+ }
832
+ },
833
+ ago: "ago",
834
+ later: "later"
835
+ })));
836
+ let tree = ele.toJSON();
662
837
  expect(tree).toMatchSnapshot();
663
838
  });
664
- it('Should display years and days1', function () {
665
- var ele = renderer.create(React.createElement(
666
- I18NProvider,
667
- {
668
- i18n: {
669
- 'nyear.ndays.later': '{0} years {1} days later',
670
- yesterday: 'yesterday'
671
- },
672
- timeZone: 'Asia/Kolkata'
673
- },
674
- React.createElement(UserTimeDiffFormat, {
675
- from: '2015-08-25T05:55:28.000Z',
676
- to: '2017-10-25T05:55:28.000Z',
677
- toTimeZone: 'Asia/Kolkata',
678
- format: function format(_ref21, pattern) {
679
- var years = _ref21.years,
680
- days = _ref21.days,
681
- months = _ref21.months,
682
- hours = _ref21.hours;
839
+ it('Should display years and days1', () => {
840
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
841
+ i18n: {
842
+ 'nyear.ndays.later': '{0} years {1} days later',
843
+ yesterday: 'yesterday'
844
+ },
845
+ timeZone: "Asia/Kolkata"
846
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
847
+ from: "2015-08-25T05:55:28.000Z",
848
+ to: "2017-10-25T05:55:28.000Z",
849
+ toTimeZone: "Asia/Kolkata",
850
+ format: (_ref21, pattern) => {
851
+ let {
852
+ years,
853
+ days,
854
+ months,
855
+ hours
856
+ } = _ref21;
683
857
 
684
- if (years > 1) {
685
- return {
686
- key: 'nyear.ndays',
687
- params: ['y', 'days']
688
- };
689
- }
690
- },
691
- ago: 'ago',
692
- later: 'later'
693
- })
694
- ));
695
- var tree = ele.toJSON();
858
+ if (years > 1) {
859
+ return {
860
+ key: 'nyear.ndays',
861
+ params: ['y', 'days']
862
+ };
863
+ }
864
+ },
865
+ ago: "ago",
866
+ later: "later"
867
+ })));
868
+ let tree = ele.toJSON();
696
869
  expect(tree).toMatchSnapshot();
697
870
  });
698
- it('Should display today key - user', function () {
699
- var ele = renderer.create(React.createElement(
700
- I18NProvider,
701
- {
702
- i18n: { today: 'today', yesterday: 'yesterday' },
703
- timeZone: 'Asia/Kolkata'
704
- },
705
- React.createElement(UserTimeDiffFormat, {
706
- to: '2016-10-25T05:55:28.000Z',
707
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
708
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
709
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
710
- others: function others(_ref22) {
711
- var years = _ref22.years,
712
- days = _ref22.days,
713
- hours = _ref22.hours,
714
- minutes = _ref22.minutes;
715
- return 'DD-MM-YYYY';
716
- },
717
- ago: 'ago',
718
- later: 'later'
719
- })
720
- ));
721
- var tree = ele.toJSON();
871
+ it('Should display today key - user', () => {
872
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
873
+ i18n: {
874
+ today: 'today',
875
+ yesterday: 'yesterday'
876
+ },
877
+ timeZone: "Asia/Kolkata"
878
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
879
+ to: "2016-10-25T05:55:28.000Z",
880
+ today: {
881
+ key: 'today',
882
+ params: ['hh', 'mm', 'ss']
883
+ },
884
+ yesterday: {
885
+ key: 'yesterday',
886
+ params: ['hh', 'mm', 'ss']
887
+ },
888
+ tomorrow: {
889
+ key: 'tomorrow',
890
+ params: ['hh', 'mm', 'ss']
891
+ },
892
+ others: _ref22 => {
893
+ let {
894
+ years,
895
+ days,
896
+ hours,
897
+ minutes
898
+ } = _ref22;
899
+ return 'DD-MM-YYYY';
900
+ },
901
+ ago: "ago",
902
+ later: "later"
903
+ })));
904
+ let tree = ele.toJSON();
722
905
  expect(tree).toMatchSnapshot();
723
906
  });
724
- it('Should display today later - user', function () {
725
- var ele = renderer.create(React.createElement(
726
- I18NProvider,
727
- {
728
- i18n: {
729
- today: 'today',
730
- yesterday: 'yesterday',
731
- 'today.later': '{0}:{1}:{2} later'
732
- },
733
- timeZone: 'Asia/Kolkata'
734
- },
735
- React.createElement(UserTimeDiffFormat, {
736
- to: '2016-10-25T05:55:29.000Z',
737
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
738
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
739
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
740
- others: function others(_ref23) {
741
- var years = _ref23.years,
742
- days = _ref23.days,
743
- hours = _ref23.hours,
744
- minutes = _ref23.minutes;
745
- return 'DD-MM-YYYY';
746
- },
747
- ago: 'ago',
748
- later: 'later'
749
- })
750
- ));
751
- var tree = ele.toJSON();
907
+ it('Should display today later - user', () => {
908
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
909
+ i18n: {
910
+ today: 'today',
911
+ yesterday: 'yesterday',
912
+ 'today.later': '{0}:{1}:{2} later'
913
+ },
914
+ timeZone: "Asia/Kolkata"
915
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
916
+ to: "2016-10-25T05:55:29.000Z",
917
+ today: {
918
+ key: 'today',
919
+ params: ['hh', 'mm', 'ss']
920
+ },
921
+ yesterday: {
922
+ key: 'yesterday',
923
+ params: ['hh', 'mm', 'ss']
924
+ },
925
+ tomorrow: {
926
+ key: 'tomorrow',
927
+ params: ['hh', 'mm', 'ss']
928
+ },
929
+ others: _ref23 => {
930
+ let {
931
+ years,
932
+ days,
933
+ hours,
934
+ minutes
935
+ } = _ref23;
936
+ return 'DD-MM-YYYY';
937
+ },
938
+ ago: "ago",
939
+ later: "later"
940
+ })));
941
+ let tree = ele.toJSON();
752
942
  expect(tree).toMatchSnapshot();
753
943
  });
754
- it('Should display today ago - user', function () {
755
- var ele = renderer.create(React.createElement(
756
- I18NProvider,
757
- {
758
- i18n: {
759
- today: 'today',
760
- yesterday: 'yesterday',
761
- 'today.later': '{0}:{1}:{2} later',
762
- 'today.ago': '{0}:{1}:{2} ago'
763
- },
764
- timeZone: 'Asia/Kolkata'
765
- },
766
- React.createElement(UserTimeDiffFormat, {
767
- to: '2016-10-25T05:55:27.000Z',
768
- today: { key: 'today', params: ['hh', 'mm', 'ss'] },
769
- yesterday: { key: 'yesterday', params: ['hh', 'mm', 'ss'] },
770
- tomorrow: { key: 'tomorrow', params: ['hh', 'mm', 'ss'] },
771
- others: function others(_ref24) {
772
- var years = _ref24.years,
773
- days = _ref24.days,
774
- hours = _ref24.hours,
775
- minutes = _ref24.minutes;
776
- return 'DD-MM-YYYY';
777
- },
778
- ago: 'ago',
779
- later: 'later'
780
- })
781
- ));
782
- var tree = ele.toJSON();
944
+ it('Should display today ago - user', () => {
945
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
946
+ i18n: {
947
+ today: 'today',
948
+ yesterday: 'yesterday',
949
+ 'today.later': '{0}:{1}:{2} later',
950
+ 'today.ago': '{0}:{1}:{2} ago'
951
+ },
952
+ timeZone: "Asia/Kolkata"
953
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
954
+ to: "2016-10-25T05:55:27.000Z",
955
+ today: {
956
+ key: 'today',
957
+ params: ['hh', 'mm', 'ss']
958
+ },
959
+ yesterday: {
960
+ key: 'yesterday',
961
+ params: ['hh', 'mm', 'ss']
962
+ },
963
+ tomorrow: {
964
+ key: 'tomorrow',
965
+ params: ['hh', 'mm', 'ss']
966
+ },
967
+ others: _ref24 => {
968
+ let {
969
+ years,
970
+ days,
971
+ hours,
972
+ minutes
973
+ } = _ref24;
974
+ return 'DD-MM-YYYY';
975
+ },
976
+ ago: "ago",
977
+ later: "later"
978
+ })));
979
+ let tree = ele.toJSON();
783
980
  expect(tree).toMatchSnapshot();
784
981
  });
785
-
786
- it('task due date set - today [hh:mm:AM/PM]', function () {
787
- var ele = renderer.create(React.createElement(
788
- I18NProvider,
789
- {
790
- i18n: {
791
- today: 'today',
792
- yesterday: 'yesterday',
793
- 'year.day': 'late by 1year 1day',
794
- 'nyear.day': 'late by {0}years 1day',
795
- 'nyear.nday': 'late by {0}years {1}days',
796
- 'year.nday': 'late by 1year {0}days',
797
- 'day.hour': 'late by 1day 1hour',
798
- 'nday.hour': 'late by {0}days 1hour',
799
- 'nday.nhour': 'late by {0}days {1}hours',
800
- 'day.nhour': 'late by 1day {0}hours',
801
- 'hour.minute': 'late by 1hour 1minute',
802
- 'nhour.minute': 'late by {0}hours 1minute',
803
- 'nhour.nminute': 'late by {0}hours {1}minutes',
804
- 'hour.nminute': 'late by 1hour {0}minutes',
805
- minute: 'late by 1minute',
806
- nminute: 'late by {0}minutes',
807
- year: 'late by 1year',
808
- nyear: 'late by {0}years',
809
- day: 'late by 1day',
810
- nday: 'late by {0} days',
811
- hour: 'late by 1hour',
812
- nhours: 'late by {0}hours'
813
- },
814
- timeZone: 'Asia/Kolkata'
982
+ it('task due date set - today [hh:mm:AM/PM]', () => {
983
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
984
+ i18n: {
985
+ today: 'today',
986
+ yesterday: 'yesterday',
987
+ 'year.day': 'late by 1year 1day',
988
+ 'nyear.day': 'late by {0}years 1day',
989
+ 'nyear.nday': 'late by {0}years {1}days',
990
+ 'year.nday': 'late by 1year {0}days',
991
+ 'day.hour': 'late by 1day 1hour',
992
+ 'nday.hour': 'late by {0}days 1hour',
993
+ 'nday.nhour': 'late by {0}days {1}hours',
994
+ 'day.nhour': 'late by 1day {0}hours',
995
+ 'hour.minute': 'late by 1hour 1minute',
996
+ 'nhour.minute': 'late by {0}hours 1minute',
997
+ 'nhour.nminute': 'late by {0}hours {1}minutes',
998
+ 'hour.nminute': 'late by 1hour {0}minutes',
999
+ minute: 'late by 1minute',
1000
+ nminute: 'late by {0}minutes',
1001
+ year: 'late by 1year',
1002
+ nyear: 'late by {0}years',
1003
+ day: 'late by 1day',
1004
+ nday: 'late by {0} days',
1005
+ hour: 'late by 1hour',
1006
+ nhours: 'late by {0}hours'
815
1007
  },
816
- React.createElement(App, null)
817
- ));
1008
+ timeZone: "Asia/Kolkata"
1009
+ }, /*#__PURE__*/React.createElement(App, null)));
1010
+
818
1011
  function App() {
819
- return React.createElement(UserTimeDiffFormat, {
820
- to: '2015-10-25T05:55:28.000Z',
821
- toTimeZone: 'Asia/Kolkata',
1012
+ return /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1013
+ to: "2015-10-25T05:55:28.000Z",
1014
+ toTimeZone: "Asia/Kolkata",
822
1015
  today: '[today] hh:mm A',
823
1016
  yesterday: 'dd:MM:YYYY hh:mm A',
824
1017
  tomorrow: '[tommorrow] hh:mm A',
825
- others: function others(_ref25) {
826
- var years = _ref25.years,
827
- days = _ref25.days,
828
- hours = _ref25.hours,
829
- minutes = _ref25.minutes;
1018
+ others: _ref25 => {
1019
+ let {
1020
+ years,
1021
+ days,
1022
+ hours,
1023
+ minutes
1024
+ } = _ref25;
830
1025
  return 'DD-MM-YYYY';
831
1026
  },
832
- ago: 'ago',
833
- later: 'later',
834
- title: i18NProviderUtils.userDateFormat('2015-10-27T05:55:28.000Z', {}, '', 'later', true, function (diffObj, pattern) {
835
- var getDateI18NString = {
836
- '1100': { key: 'year.day', params: ['yy', 'yDays'] },
837
- '2100': { key: 'nyear.day', params: ['yy', 'yDays'] },
838
- '2200': { key: 'nyear.nday', params: ['yy', 'yDays'] },
839
- '1200': { key: 'year.nday', params: ['yDays'] },
840
- '0110': { key: 'day.hour', params: ['yDays', 'hh'] },
841
- '0210': { key: 'nday.hour', params: ['yDays', 'hh'] },
842
- '0220': { key: 'nday.nhour', params: ['yDays', 'hh'] },
843
- '0120': { key: 'day.nhour', params: ['hh'] },
844
- '0011': { key: 'hour.minute', params: ['hh', 'mm'] },
845
- '0021': { key: 'nhour.minute', params: ['hh', 'mm'] },
846
- '0022': { key: 'nhour.nminute', params: ['hh', 'mm'] },
847
- '0012': { key: 'hour.nminute', params: ['mm'] },
848
- '0001': { key: 'minute', params: ['mm'] },
849
- '0002': { key: 'nminute', params: ['mm'] },
850
- '1000': { key: 'year', params: ['yy'] },
851
- '2000': { key: 'nyear', params: ['yy'] },
852
- '0100': { key: 'day', params: ['yDays'] },
853
- '0200': { key: 'nday', params: ['yDays'] },
854
- '0010': { key: 'hour', params: ['hh'] },
855
- '0020': { key: 'nhours', params: ['hh']
1027
+ ago: "ago",
1028
+ later: "later",
1029
+ title: i18NProviderUtils.userDateFormat('2015-10-27T05:55:28.000Z', {}, '', 'later', true, (diffObj, pattern) => {
1030
+ let getDateI18NString = {
1031
+ '1100': {
1032
+ key: 'year.day',
1033
+ params: ['yy', 'yDays']
1034
+ },
1035
+ '2100': {
1036
+ key: 'nyear.day',
1037
+ params: ['yy', 'yDays']
1038
+ },
1039
+ '2200': {
1040
+ key: 'nyear.nday',
1041
+ params: ['yy', 'yDays']
1042
+ },
1043
+ '1200': {
1044
+ key: 'year.nday',
1045
+ params: ['yDays']
1046
+ },
1047
+ '0110': {
1048
+ key: 'day.hour',
1049
+ params: ['yDays', 'hh']
1050
+ },
1051
+ '0210': {
1052
+ key: 'nday.hour',
1053
+ params: ['yDays', 'hh']
1054
+ },
1055
+ '0220': {
1056
+ key: 'nday.nhour',
1057
+ params: ['yDays', 'hh']
1058
+ },
1059
+ '0120': {
1060
+ key: 'day.nhour',
1061
+ params: ['hh']
1062
+ },
1063
+ '0011': {
1064
+ key: 'hour.minute',
1065
+ params: ['hh', 'mm']
1066
+ },
1067
+ '0021': {
1068
+ key: 'nhour.minute',
1069
+ params: ['hh', 'mm']
1070
+ },
1071
+ '0022': {
1072
+ key: 'nhour.nminute',
1073
+ params: ['hh', 'mm']
1074
+ },
1075
+ '0012': {
1076
+ key: 'hour.nminute',
1077
+ params: ['mm']
1078
+ },
1079
+ '0001': {
1080
+ key: 'minute',
1081
+ params: ['mm']
1082
+ },
1083
+ '0002': {
1084
+ key: 'nminute',
1085
+ params: ['mm']
1086
+ },
1087
+ '1000': {
1088
+ key: 'year',
1089
+ params: ['yy']
1090
+ },
1091
+ '2000': {
1092
+ key: 'nyear',
1093
+ params: ['yy']
1094
+ },
1095
+ '0100': {
1096
+ key: 'day',
1097
+ params: ['yDays']
1098
+ },
1099
+ '0200': {
1100
+ key: 'nday',
1101
+ params: ['yDays']
1102
+ },
1103
+ '0010': {
1104
+ key: 'hour',
1105
+ params: ['hh']
1106
+ },
1107
+ '0020': {
1108
+ key: 'nhours',
1109
+ params: ['hh']
1110
+ } // '0000': 'support.label.just.now',
1111
+ // '0001': 'support.1minute',
1112
+ // '0002': 'support.nminutes',
1113
+ // '0010': 'support.1hour',
1114
+ // '0011': 'support.1hour.1minute',
1115
+ // '0012': 'support.1hour.nminutes',
1116
+ // '0020': 'support.nhours',
1117
+ // '0021': 'support.nhours.1minute',
1118
+ // '0022': 'support.nhours.nminutes',
1119
+ // '0100': 'support.1day',
1120
+ // '0110': 'support.1day.1hour',
1121
+ // '0120': 'support.1day.nhours',
1122
+ // '0200': 'support.ndays',
1123
+ // '0210': 'support.ndays.1hour',
1124
+ // '0220': 'support.ndays.nhours',
1125
+ // '1000': 'support.1year',
1126
+ // '1100': 'support.1year.1day',
1127
+ // '1200': 'support.1year.ndays',
1128
+ // '2000': 'support.nyears',
1129
+ // '2100': 'support.nyears.1day',
1130
+ // '2200': 'support.nyears.ndays'
856
1131
 
857
- // '0000': 'support.label.just.now',
858
- // '0001': 'support.1minute',
859
- // '0002': 'support.nminutes',
860
- // '0010': 'support.1hour',
861
- // '0011': 'support.1hour.1minute',
862
- // '0012': 'support.1hour.nminutes',
863
- // '0020': 'support.nhours',
864
- // '0021': 'support.nhours.1minute',
865
- // '0022': 'support.nhours.nminutes',
866
- // '0100': 'support.1day',
867
- // '0110': 'support.1day.1hour',
868
- // '0120': 'support.1day.nhours',
869
- // '0200': 'support.ndays',
870
- // '0210': 'support.ndays.1hour',
871
- // '0220': 'support.ndays.nhours',
872
- // '1000': 'support.1year',
873
- // '1100': 'support.1year.1day',
874
- // '1200': 'support.1year.ndays',
875
- // '2000': 'support.nyears',
876
- // '2100': 'support.nyears.1day',
877
- // '2200': 'support.nyears.ndays'
878
- } };
879
- return getDateI18NString[pattern] ? getDateI18NString[pattern] : 'hh:mm A';
880
- // console.log(pattern, '===========>>>>pattern');
1132
+ };
1133
+ return getDateI18NString[pattern] ? getDateI18NString[pattern] : 'hh:mm A'; // console.log(pattern, '===========>>>>pattern');
881
1134
  // let { years, months, yDays: days, hours, minutes } = diffObj;
882
1135
  // if (years == 1 && days == 1) {
883
1136
  // return { key: 'year.day', pattern: ['YY', 'DD'] };
@@ -917,324 +1170,319 @@ describe('UserTimeDiffFormat component', function () {
917
1170
  })
918
1171
  });
919
1172
  }
920
- var tree = ele.toJSON();
921
- expect(tree).toMatchSnapshot();
922
- });
923
1173
 
924
- it('task due date set - tomorrow [hh:mm:AM/PM]', function () {
925
- var ele = renderer.create(React.createElement(
926
- I18NProvider,
927
- {
928
- i18n: { today: 'today', yesterday: 'yesterday' },
929
- timeZone: 'Asia/Kolkata'
930
- },
931
- React.createElement(UserTimeDiffFormat, {
932
- to: '2016-10-26T04:55:28.000Z',
933
- toTimeZone: 'Asia/Kolkata',
934
- today: '[today] hh:mm A',
935
- yesterday: 'dd:MM:YYYY hh:mm A',
936
- tomorrow: '[tommorrow] hh:mm A',
937
- others: function others(_ref26) {
938
- var years = _ref26.years,
939
- days = _ref26.days,
940
- hours = _ref26.hours,
941
- minutes = _ref26.minutes;
942
- return 'DD-MM-YYYY';
943
- },
944
- ago: 'ago',
945
- later: 'later'
946
- })
947
- ));
948
- var tree = ele.toJSON();
1174
+ let tree = ele.toJSON();
949
1175
  expect(tree).toMatchSnapshot();
950
1176
  });
951
- it('task due date set - yesterday dd:MM:YYYY hh:mm:A', function () {
952
- var ele = renderer.create(React.createElement(
953
- I18NProvider,
954
- {
955
- i18n: { today: 'today', yesterday: 'yesterday' },
956
- timeZone: 'Asia/Kolkata'
957
- },
958
- React.createElement(UserTimeDiffFormat, {
959
- to: '2016-10-24T06:55:28.000Z',
960
- toTimeZone: 'Asia/Kolkata',
961
- today: '[today] hh:mm A',
962
- yesterday: 'DD/MM/YYYY hh:mm A',
963
- tomorrow: '[tommorrow] hh:mm A',
964
- others: function others(_ref27) {
965
- var years = _ref27.years,
966
- days = _ref27.days,
967
- hours = _ref27.hours,
968
- minutes = _ref27.minutes;
969
- return 'DD-MM-YYYY';
970
- },
971
- ago: 'ago',
972
- later: 'later'
973
- })
974
- ));
975
- var tree = ele.toJSON();
1177
+ it('task due date set - tomorrow [hh:mm:AM/PM]', () => {
1178
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
1179
+ i18n: {
1180
+ today: 'today',
1181
+ yesterday: 'yesterday'
1182
+ },
1183
+ timeZone: "Asia/Kolkata"
1184
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1185
+ to: "2016-10-26T04:55:28.000Z",
1186
+ toTimeZone: "Asia/Kolkata",
1187
+ today: '[today] hh:mm A',
1188
+ yesterday: 'dd:MM:YYYY hh:mm A',
1189
+ tomorrow: '[tommorrow] hh:mm A',
1190
+ others: _ref26 => {
1191
+ let {
1192
+ years,
1193
+ days,
1194
+ hours,
1195
+ minutes
1196
+ } = _ref26;
1197
+ return 'DD-MM-YYYY';
1198
+ },
1199
+ ago: "ago",
1200
+ later: "later"
1201
+ })));
1202
+ let tree = ele.toJSON();
976
1203
  expect(tree).toMatchSnapshot();
977
1204
  });
978
-
979
- it('task due date set - overdue', function () {
980
- var ele = renderer.create(React.createElement(
981
- I18NProvider,
982
- {
983
- i18n: { 'overdue.ago': 'late by {0}' },
984
- timeZone: 'Asia/Kolkata'
985
- },
986
- React.createElement(UserTimeDiffFormat, {
987
- to: '2016-10-24T05:55:28.000Z',
988
- toTimeZone: 'Asia/Kolkata',
989
- format: function format(diff, pattern) {
990
- switch (pattern) {
991
- case '000000':
992
- case '000001':
993
- case '000002':
994
- case '000010':
995
- case '000011':
996
- case '000012':
997
- case '000022':
998
- case '000100':
999
- case '000101':
1000
- case '000102':
1001
- case '000110':
1002
- case '000111':
1003
- case '000112':
1004
- case '000120':
1005
- case '000121':
1006
- case '000122':
1007
- case '000200':
1008
- return {
1009
- key: 'overdue',
1010
- params: ['dd']
1011
- };
1012
- }
1013
- },
1014
- ago: 'ago',
1015
- later: 'later'
1016
- })
1017
- ));
1018
- var tree = ele.toJSON();
1205
+ it('task due date set - yesterday dd:MM:YYYY hh:mm:A', () => {
1206
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
1207
+ i18n: {
1208
+ today: 'today',
1209
+ yesterday: 'yesterday'
1210
+ },
1211
+ timeZone: "Asia/Kolkata"
1212
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1213
+ to: "2016-10-24T06:55:28.000Z",
1214
+ toTimeZone: "Asia/Kolkata",
1215
+ today: '[today] hh:mm A',
1216
+ yesterday: 'DD/MM/YYYY hh:mm A',
1217
+ tomorrow: '[tommorrow] hh:mm A',
1218
+ others: _ref27 => {
1219
+ let {
1220
+ years,
1221
+ days,
1222
+ hours,
1223
+ minutes
1224
+ } = _ref27;
1225
+ return 'DD-MM-YYYY';
1226
+ },
1227
+ ago: "ago",
1228
+ later: "later"
1229
+ })));
1230
+ let tree = ele.toJSON();
1019
1231
  expect(tree).toMatchSnapshot();
1020
1232
  });
1021
- //2016-10-25T05:55:28.000Z
1022
- it('created time today', function () {
1023
- var ele = renderer.create(React.createElement(
1024
- I18NProvider,
1025
- {
1026
- i18n: { 'overdue.ago': 'late by {0}' },
1027
- timeZone: 'Asia/Kolkata'
1028
- },
1029
- React.createElement(UserTimeDiffFormat, {
1030
- to: '2016-10-25T06:55:28.000Z',
1031
- today: 'hh:mm A',
1032
- yesterday: 'DD/MM/YYYY hh:mm A',
1033
- tomorrow: '[tommorrow] hh:mm A',
1034
- others: function others(_ref28) {
1035
- var years = _ref28.years,
1036
- days = _ref28.days,
1037
- hours = _ref28.hours,
1038
- minutes = _ref28.minutes;
1039
- return 'DD-MM-YYYY';
1040
- },
1041
- ago: 'ago',
1042
- later: 'later'
1043
- })
1044
- ));
1045
- var tree = ele.toJSON();
1233
+ it('task due date set - overdue', () => {
1234
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
1235
+ i18n: {
1236
+ 'overdue.ago': 'late by {0}'
1237
+ },
1238
+ timeZone: "Asia/Kolkata"
1239
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1240
+ to: "2016-10-24T05:55:28.000Z",
1241
+ toTimeZone: "Asia/Kolkata",
1242
+ format: (diff, pattern) => {
1243
+ switch (pattern) {
1244
+ case '000000':
1245
+ case '000001':
1246
+ case '000002':
1247
+ case '000010':
1248
+ case '000011':
1249
+ case '000012':
1250
+ case '000022':
1251
+ case '000100':
1252
+ case '000101':
1253
+ case '000102':
1254
+ case '000110':
1255
+ case '000111':
1256
+ case '000112':
1257
+ case '000120':
1258
+ case '000121':
1259
+ case '000122':
1260
+ case '000200':
1261
+ return {
1262
+ key: 'overdue',
1263
+ params: ['dd']
1264
+ };
1265
+ }
1266
+ },
1267
+ ago: "ago",
1268
+ later: "later"
1269
+ })));
1270
+ let tree = ele.toJSON();
1271
+ expect(tree).toMatchSnapshot();
1272
+ }); //2016-10-25T05:55:28.000Z
1273
+
1274
+ it('created time today', () => {
1275
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
1276
+ i18n: {
1277
+ 'overdue.ago': 'late by {0}'
1278
+ },
1279
+ timeZone: "Asia/Kolkata"
1280
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1281
+ to: "2016-10-25T06:55:28.000Z",
1282
+ today: 'hh:mm A',
1283
+ yesterday: 'DD/MM/YYYY hh:mm A',
1284
+ tomorrow: '[tommorrow] hh:mm A',
1285
+ others: _ref28 => {
1286
+ let {
1287
+ years,
1288
+ days,
1289
+ hours,
1290
+ minutes
1291
+ } = _ref28;
1292
+ return 'DD-MM-YYYY';
1293
+ },
1294
+ ago: "ago",
1295
+ later: "later"
1296
+ })));
1297
+ let tree = ele.toJSON();
1046
1298
  expect(tree).toMatchSnapshot();
1047
1299
  });
1048
- it('created time yesterday', function () {
1049
- var ele = renderer.create(React.createElement(
1050
- I18NProvider,
1051
- {
1052
- i18n: { 'overdue.ago': 'late by {0}' },
1053
- timeZone: 'Asia/Kolkata'
1054
- },
1055
- React.createElement(UserTimeDiffFormat, {
1056
- to: '2016-10-24T06:55:28.000Z',
1057
- today: 'hh:mm A',
1058
- yesterday: '[yesterday] hh:mm A',
1059
- tomorrow: '[tommorrow] hh:mm A',
1060
- others: function others(_ref29) {
1061
- var years = _ref29.years,
1062
- days = _ref29.days,
1063
- hours = _ref29.hours,
1064
- minutes = _ref29.minutes;
1065
- return 'DD-MM-YYYY';
1066
- },
1067
- ago: 'ago',
1068
- later: 'later'
1069
- })
1070
- ));
1071
- var tree = ele.toJSON();
1300
+ it('created time yesterday', () => {
1301
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
1302
+ i18n: {
1303
+ 'overdue.ago': 'late by {0}'
1304
+ },
1305
+ timeZone: "Asia/Kolkata"
1306
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1307
+ to: "2016-10-24T06:55:28.000Z",
1308
+ today: 'hh:mm A',
1309
+ yesterday: '[yesterday] hh:mm A',
1310
+ tomorrow: '[tommorrow] hh:mm A',
1311
+ others: _ref29 => {
1312
+ let {
1313
+ years,
1314
+ days,
1315
+ hours,
1316
+ minutes
1317
+ } = _ref29;
1318
+ return 'DD-MM-YYYY';
1319
+ },
1320
+ ago: "ago",
1321
+ later: "later"
1322
+ })));
1323
+ let tree = ele.toJSON();
1072
1324
  expect(tree).toMatchSnapshot();
1073
1325
  });
1074
- it('created time tomorrow', function () {
1075
- var ele = renderer.create(React.createElement(
1076
- I18NProvider,
1077
- {
1078
- i18n: { 'overdue.ago': 'late by {0}' },
1079
- timeZone: 'Asia/Kolkata'
1080
- },
1081
- React.createElement(UserTimeDiffFormat, {
1082
- to: '2016-10-26T06:55:28.000Z',
1083
- today: 'hh:mm A',
1084
- yesterday: '[yesterday] hh:mm A',
1085
- tomorrow: '[tommorrow] hh:mm A',
1086
- others: function others(_ref30) {
1087
- var years = _ref30.years,
1088
- days = _ref30.days,
1089
- hours = _ref30.hours,
1090
- minutes = _ref30.minutes;
1091
- return 'DD-MM-YYYY';
1092
- },
1093
- ago: 'ago',
1094
- later: 'later'
1095
- })
1096
- ));
1097
- var tree = ele.toJSON();
1326
+ it('created time tomorrow', () => {
1327
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
1328
+ i18n: {
1329
+ 'overdue.ago': 'late by {0}'
1330
+ },
1331
+ timeZone: "Asia/Kolkata"
1332
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1333
+ to: "2016-10-26T06:55:28.000Z",
1334
+ today: 'hh:mm A',
1335
+ yesterday: '[yesterday] hh:mm A',
1336
+ tomorrow: '[tommorrow] hh:mm A',
1337
+ others: _ref30 => {
1338
+ let {
1339
+ years,
1340
+ days,
1341
+ hours,
1342
+ minutes
1343
+ } = _ref30;
1344
+ return 'DD-MM-YYYY';
1345
+ },
1346
+ ago: "ago",
1347
+ later: "later"
1348
+ })));
1349
+ let tree = ele.toJSON();
1098
1350
  expect(tree).toMatchSnapshot();
1099
1351
  });
1100
- it('created time within 7 days', function () {
1101
- var ele = renderer.create(React.createElement(
1102
- I18NProvider,
1103
- {
1104
- i18n: {
1105
- 'overdue.ago': 'late by {0}',
1106
- 'support.ndays.nhours.ago': '{0} days {1} hours ago',
1107
- 'support.ndays.1hour.ago': '{0} days one hour ago'
1108
- },
1109
- timeZone: 'Asia/Kolkata'
1352
+ it('created time within 7 days', () => {
1353
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
1354
+ i18n: {
1355
+ 'overdue.ago': 'late by {0}',
1356
+ 'support.ndays.nhours.ago': '{0} days {1} hours ago',
1357
+ 'support.ndays.1hour.ago': '{0} days one hour ago'
1110
1358
  },
1111
- React.createElement(UserTimeDiffFormat, {
1112
- to: '2016-10-19T06:55:28.000Z',
1113
- today: 'hh:mm A',
1114
- yesterday: '[yesterday] hh:mm A',
1115
- tomorrow: '[tommorrow] hh:mm A',
1116
- others: function others(_ref31) {
1117
- var years = _ref31.years,
1118
- months = _ref31.months,
1119
- days = _ref31.days,
1120
- hours = _ref31.hours,
1121
- minutes = _ref31.minutes,
1122
- yDays = _ref31.yDays;
1359
+ timeZone: "Asia/Kolkata"
1360
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1361
+ to: "2016-10-19T06:55:28.000Z",
1362
+ today: 'hh:mm A',
1363
+ yesterday: '[yesterday] hh:mm A',
1364
+ tomorrow: '[tommorrow] hh:mm A',
1365
+ others: _ref31 => {
1366
+ let {
1367
+ years,
1368
+ months,
1369
+ days,
1370
+ hours,
1371
+ minutes,
1372
+ yDays
1373
+ } = _ref31;
1374
+ years = years > 1 ? '2' : years; // months = diffObj1.months > 1 ? '2' : diffObj1.months;
1375
+ //days = diffObj1.days > 1 ? '2' : diffObj1.days;
1123
1376
 
1124
- years = years > 1 ? '2' : years;
1125
- // months = diffObj1.months > 1 ? '2' : diffObj1.months;
1126
- //days = diffObj1.days > 1 ? '2' : diffObj1.days;
1127
- days = yDays > 1 ? '2' : yDays;
1128
- hours = hours > 1 ? '2' : hours;
1129
- minutes = minutes > 1 ? '2' : minutes;
1130
- //seconds = diffObj1.seconds > 1 ? '2' : diffObj1.seconds;
1131
- // let pattern = '' + years + months + days + hours + minutes + seconds;
1132
- var count = 0;
1133
- var pattern = [years, days, hours, minutes].reduce(function (res, next) {
1134
- if (count == 2) {
1135
- res = res + '0';
1136
- } else if (next != 0) {
1137
- count++;
1138
- res = res + next;
1139
- } else {
1140
- res = res + next;
1141
- }
1142
- return res;
1143
- }, '');
1144
- var getDateI18NString = {
1145
- '0000': 'support.label.just.now',
1146
- '0001': 'support.1minute',
1147
- '0002': 'support.nminutes',
1148
- '0010': 'support.1hour',
1149
- '0011': 'support.1hour.1minute',
1150
- '0012': 'support.1hour.nminutes',
1151
- '0020': 'support.nhours',
1152
- '0021': 'support.nhours.1minute',
1153
- '0022': 'support.nhours.nminutes',
1154
- '0100': 'support.1day',
1155
- '0110': 'support.1day.1hour',
1156
- '0120': 'support.1day.nhours',
1157
- '0200': 'support.ndays',
1158
- '0210': 'support.ndays.1hour',
1159
- '0220': 'support.ndays.nhours',
1160
- '1000': 'support.1year',
1161
- '1100': 'support.1year.1day',
1162
- '1200': 'support.1year.ndays',
1163
- '2000': 'support.nyears',
1164
- '2100': 'support.nyears.1day',
1165
- '2200': 'support.nyears.ndays'
1166
- };
1167
- if (years == 0 && months == 0 && days < 7) {
1168
- return {
1169
- key: getDateI18NString[pattern],
1170
- params: ['d', 'h']
1171
- };
1377
+ days = yDays > 1 ? '2' : yDays;
1378
+ hours = hours > 1 ? '2' : hours;
1379
+ minutes = minutes > 1 ? '2' : minutes; //seconds = diffObj1.seconds > 1 ? '2' : diffObj1.seconds;
1380
+ // let pattern = '' + years + months + days + hours + minutes + seconds;
1381
+
1382
+ let count = 0;
1383
+ let pattern = [years, days, hours, minutes].reduce((res, next) => {
1384
+ if (count == 2) {
1385
+ res = `${res}0`;
1386
+ } else if (next != 0) {
1387
+ count++;
1388
+ res = res + next;
1389
+ } else {
1390
+ res = res + next;
1172
1391
  }
1173
- },
1174
- ago: 'ago',
1175
- later: 'later'
1176
- })
1177
- ));
1178
- var tree = ele.toJSON();
1392
+
1393
+ return res;
1394
+ }, '');
1395
+ let getDateI18NString = {
1396
+ '0000': 'support.label.just.now',
1397
+ '0001': 'support.1minute',
1398
+ '0002': 'support.nminutes',
1399
+ '0010': 'support.1hour',
1400
+ '0011': 'support.1hour.1minute',
1401
+ '0012': 'support.1hour.nminutes',
1402
+ '0020': 'support.nhours',
1403
+ '0021': 'support.nhours.1minute',
1404
+ '0022': 'support.nhours.nminutes',
1405
+ '0100': 'support.1day',
1406
+ '0110': 'support.1day.1hour',
1407
+ '0120': 'support.1day.nhours',
1408
+ '0200': 'support.ndays',
1409
+ '0210': 'support.ndays.1hour',
1410
+ '0220': 'support.ndays.nhours',
1411
+ '1000': 'support.1year',
1412
+ '1100': 'support.1year.1day',
1413
+ '1200': 'support.1year.ndays',
1414
+ '2000': 'support.nyears',
1415
+ '2100': 'support.nyears.1day',
1416
+ '2200': 'support.nyears.ndays'
1417
+ };
1418
+
1419
+ if (years == 0 && months == 0 && days < 7) {
1420
+ return {
1421
+ key: getDateI18NString[pattern],
1422
+ params: ['d', 'h']
1423
+ };
1424
+ }
1425
+ },
1426
+ ago: "ago",
1427
+ later: "later"
1428
+ })));
1429
+ let tree = ele.toJSON();
1179
1430
  expect(tree).toMatchSnapshot();
1180
1431
  });
1432
+ it('created time within pattern', () => {
1433
+ let ele = renderer.create( /*#__PURE__*/React.createElement(I18NProvider, {
1434
+ i18n: {
1435
+ 'overdue.ago': 'late by {0}',
1436
+ 'support.ndays.nhours.ago': '{0} days {1} hours ago',
1437
+ 'support.ndays.1hour.ago': '{0} days one hour ago'
1438
+ },
1439
+ timeZone: "Asia/Kolkata"
1440
+ }, /*#__PURE__*/React.createElement(UserTimeDiffFormat, {
1441
+ to: "2016-10-19T06:55:28.000Z",
1442
+ format: (_ref32, pattern) => {
1443
+ let {
1444
+ years,
1445
+ months,
1446
+ days,
1447
+ hours,
1448
+ minutes,
1449
+ yDays
1450
+ } = _ref32;
1451
+ let getDateI18NString = {
1452
+ '0000': 'support.label.just.now',
1453
+ '0001': 'support.1minute',
1454
+ '0002': 'support.nminutes',
1455
+ '0010': 'support.1hour',
1456
+ '0011': 'support.1hour.1minute',
1457
+ '0012': 'support.1hour.nminutes',
1458
+ '0020': 'support.nhours',
1459
+ '0021': 'support.nhours.1minute',
1460
+ '0022': 'support.nhours.nminutes',
1461
+ '0100': 'support.1day',
1462
+ '0110': 'support.1day.1hour',
1463
+ '0120': 'support.1day.nhours',
1464
+ '0200': 'support.ndays',
1465
+ '0210': 'support.ndays.1hour',
1466
+ '0220': 'support.ndays.nhours',
1467
+ '1000': 'support.1year',
1468
+ '1100': 'support.1year.1day',
1469
+ '1200': 'support.1year.ndays',
1470
+ '2000': 'support.nyears',
1471
+ '2100': 'support.nyears.1day',
1472
+ '2200': 'support.nyears.ndays'
1473
+ };
1181
1474
 
1182
- it('created time within pattern', function () {
1183
- var ele = renderer.create(React.createElement(
1184
- I18NProvider,
1185
- {
1186
- i18n: {
1187
- 'overdue.ago': 'late by {0}',
1188
- 'support.ndays.nhours.ago': '{0} days {1} hours ago',
1189
- 'support.ndays.1hour.ago': '{0} days one hour ago'
1190
- },
1191
- timeZone: 'Asia/Kolkata'
1192
- },
1193
- React.createElement(UserTimeDiffFormat, {
1194
- to: '2016-10-19T06:55:28.000Z',
1195
- format: function format(_ref32, pattern) {
1196
- var years = _ref32.years,
1197
- months = _ref32.months,
1198
- days = _ref32.days,
1199
- hours = _ref32.hours,
1200
- minutes = _ref32.minutes,
1201
- yDays = _ref32.yDays;
1202
-
1203
- var getDateI18NString = {
1204
- '0000': 'support.label.just.now',
1205
- '0001': 'support.1minute',
1206
- '0002': 'support.nminutes',
1207
- '0010': 'support.1hour',
1208
- '0011': 'support.1hour.1minute',
1209
- '0012': 'support.1hour.nminutes',
1210
- '0020': 'support.nhours',
1211
- '0021': 'support.nhours.1minute',
1212
- '0022': 'support.nhours.nminutes',
1213
- '0100': 'support.1day',
1214
- '0110': 'support.1day.1hour',
1215
- '0120': 'support.1day.nhours',
1216
- '0200': 'support.ndays',
1217
- '0210': 'support.ndays.1hour',
1218
- '0220': 'support.ndays.nhours',
1219
- '1000': 'support.1year',
1220
- '1100': 'support.1year.1day',
1221
- '1200': 'support.1year.ndays',
1222
- '2000': 'support.nyears',
1223
- '2100': 'support.nyears.1day',
1224
- '2200': 'support.nyears.ndays'
1475
+ if (years == 0 && months == 0 && days < 7) {
1476
+ return {
1477
+ key: getDateI18NString[pattern],
1478
+ params: ['d', 'h']
1225
1479
  };
1226
- if (years == 0 && months == 0 && days < 7) {
1227
- return {
1228
- key: getDateI18NString[pattern],
1229
- params: ['d', 'h']
1230
- };
1231
- }
1232
- },
1233
- ago: 'ago',
1234
- later: 'later'
1235
- })
1236
- ));
1237
- var tree = ele.toJSON();
1480
+ }
1481
+ },
1482
+ ago: "ago",
1483
+ later: "later"
1484
+ })));
1485
+ let tree = ele.toJSON();
1238
1486
  expect(tree).toMatchSnapshot();
1239
1487
  });
1240
1488
  });