@zohodesk/i18n 1.0.0-beta.16 → 1.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/es/components/DateTimeDiffFormat.js +3 -2
- package/es/components/HOCI18N.js +33 -30
- package/es/components/I18NProvider.js +9 -2
- package/es/components/UserTimeDiffFormat.js +6 -5
- package/es/components/__tests__/DateTimeDiffFormat.spec.js +177 -136
- package/es/components/__tests__/FormatText.spec.js +0 -1
- package/es/components/__tests__/HOCI18N.spec.js +0 -1
- package/es/components/__tests__/I18N.spec.js +0 -2
- package/es/components/__tests__/I18NProvider.spec.js +0 -1
- package/es/components/__tests__/PluralFormat.spec.js +0 -1
- package/es/components/__tests__/UserTimeDiffFormat.spec.js +287 -206
- package/es/index.js +1 -1
- package/es/utils.js +55 -15
- package/lib/components/DateTimeDiffFormat.js +7 -6
- package/lib/components/FormatText.js +4 -4
- package/lib/components/HOCI18N.js +4 -4
- package/lib/components/I18N.js +4 -4
- package/lib/components/I18NProvider.js +15 -7
- package/lib/components/PluralFormat.js +4 -4
- package/lib/components/UserTimeDiffFormat.js +4 -4
- package/lib/components/__tests__/I18NProvider.spec.js +1 -1
- package/lib/components/__tests__/UserTimeDiffFormat.spec.js +1 -1
- package/lib/index.js +58 -52
- package/lib/utils.js +62 -23
- package/package.json +3 -3
- package/src/components/DateTimeDiffFormat.js +3 -0
- package/src/components/I18NProvider.js +18 -14
- package/src/index.js +2 -1
- package/src/utils.js +37 -4
package/README.md
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
# i18n
|
|
2
2
|
|
|
3
|
+
# 1.0.0-beta.19
|
|
4
|
+
|
|
5
|
+
- In this version we have made changes in i18n provider to call user date format function only if the time zone data is available.
|
|
6
|
+
# 1.0.0-beta.18
|
|
7
|
+
|
|
8
|
+
- Localization feature added and incorporated into getI18NValue Method.
|
|
9
|
+
|
|
10
|
+
# 1.0.0-beta.17
|
|
11
|
+
|
|
12
|
+
- There was some i18n changes done in live before moving the date format build to live. Since we need these changes we have published it as new version.
|
|
13
|
+
|
|
3
14
|
# 1.0.0-beta.16
|
|
4
15
|
|
|
5
16
|
- DatePattern and dateTimePattern key has been changed for the date format build.
|
|
6
17
|
|
|
18
|
+
# 1.0.0-beta.15.1
|
|
19
|
+
|
|
20
|
+
- Zoho security version updated.
|
|
21
|
+
|
|
7
22
|
# 1.0.0-beta.15
|
|
8
23
|
|
|
9
24
|
- When working on date format build we have published I18n. Also, before moving date format build to master we had a emergency fix that need to be sent, so when publishing I18n we have published the date format changes with the next version.
|
|
@@ -94,7 +94,8 @@ export default class DateTimeDiffFormat extends React.Component {
|
|
|
94
94
|
timeFormat: timeFormat,
|
|
95
95
|
datePattern: datePattern,
|
|
96
96
|
dateTimePattern: `${datePattern} ${timeFormat}`
|
|
97
|
-
};
|
|
97
|
+
}; //In if condition we'll remove year and set date format if the current year is not required
|
|
98
|
+
//In else part we'll set the date format as it is
|
|
98
99
|
|
|
99
100
|
if (isEnabledCurrentYear === true && diffObj1.years === 0 && diffObj1.tYear === diffObj1.crntYear) {
|
|
100
101
|
let dateFormat = getDatePatternWithoutYear(datePattern);
|
|
@@ -147,7 +148,7 @@ export default class DateTimeDiffFormat extends React.Component {
|
|
|
147
148
|
} else {
|
|
148
149
|
let dateObj = new Date(toDateObj);
|
|
149
150
|
let curDateObj = new Date(fromDateObj);
|
|
150
|
-
let diffDayType = diffObj1.yDays;
|
|
151
|
+
let diffDayType = diffObj1.yDays; //In this condition, to calculate different days we have copied it from live --> diffDayType
|
|
151
152
|
|
|
152
153
|
if (isOverdue && dateObj.getDate() < curDateObj.getDate() && diffObj1.yDays == 0) {
|
|
153
154
|
diffDayType = -1;
|
package/es/components/HOCI18N.js
CHANGED
|
@@ -4,44 +4,47 @@ import React, { Children } from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { replaceI18NValuesWithRegex, unescapeUnicode } from '../utils';
|
|
6
6
|
import { I18NContext } from '../I18NContext';
|
|
7
|
-
export default ((
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
export default (function () {
|
|
8
|
+
let i18NKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
9
|
+
return Component => {
|
|
10
|
+
class HOCI18N extends React.Component {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
this.getI18NValue = this.getI18NValue.bind(this);
|
|
14
|
+
}
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
getI18NValue(key) {
|
|
17
|
+
const {
|
|
18
|
+
i18n
|
|
19
|
+
} = this.context || {};
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (typeof i18n === 'undefined') {
|
|
22
|
+
return key;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let i18nStr = i18n[key];
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
if (i18nStr === undefined) {
|
|
28
|
+
return key;
|
|
29
|
+
}
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
return key;
|
|
31
|
+
return unescapeUnicode(i18nStr);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
render() {
|
|
35
|
+
let i18nProps = i18NKeys.reduce((result, key) => {
|
|
36
|
+
if (this.props[key]) {
|
|
37
|
+
result[key] = this.getI18NValue(this.props[key]);
|
|
38
|
+
}
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
40
|
+
return result;
|
|
41
|
+
}, {});
|
|
42
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, this.props, i18nProps));
|
|
43
|
+
}
|
|
37
44
|
|
|
38
|
-
return result;
|
|
39
|
-
}, {});
|
|
40
|
-
return /*#__PURE__*/React.createElement(Component, _extends({}, this.props, i18nProps));
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return HOCI18N;
|
|
47
|
+
HOCI18N.contextType = I18NContext;
|
|
48
|
+
return HOCI18N;
|
|
49
|
+
};
|
|
47
50
|
});
|
|
@@ -14,7 +14,10 @@ export default class I18NProvider extends React.Component {
|
|
|
14
14
|
constructor(props, context) {
|
|
15
15
|
super(props, context);
|
|
16
16
|
i18NProviderUtils.getI18NValue = getI18NValue(props.i18n);
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
if (props.tzData) {
|
|
19
|
+
i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, props.isEnabledCurrentYear);
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
componentDidUpdate(next) {
|
|
@@ -34,7 +37,11 @@ export default class I18NProvider extends React.Component {
|
|
|
34
37
|
this.reject = rej;
|
|
35
38
|
}).then(() => {
|
|
36
39
|
i18NProviderUtils.getI18NValue = getI18NValue(nextProps.i18n);
|
|
37
|
-
|
|
40
|
+
|
|
41
|
+
if (props.tzData) {
|
|
42
|
+
i18NProviderUtils.userDateFormat = userDateFormat(i18NProviderUtils.getI18NValue, props.tzData, props.timeFormat, props.datePattern, this.props.isEnabledCurrentYear);
|
|
43
|
+
}
|
|
44
|
+
|
|
38
45
|
this.promise = null;
|
|
39
46
|
}, () => {
|
|
40
47
|
this.promise = null;
|
|
@@ -32,11 +32,12 @@ export default class UserTimeDiffFormat extends Component {
|
|
|
32
32
|
} = this.context || {};
|
|
33
33
|
|
|
34
34
|
if (!format && !others) {
|
|
35
|
-
format =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
format = _ref => {
|
|
36
|
+
let {
|
|
37
|
+
dateTimeFormat,
|
|
38
|
+
dateFormat,
|
|
39
|
+
timeFormat
|
|
40
|
+
} = _ref;
|
|
40
41
|
displayType === 'dateTime' ? dateTimeFormat : displayType === 'date' ? dateFormat : timeFormat;
|
|
41
42
|
};
|
|
42
43
|
}
|
|
@@ -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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
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
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
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
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
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
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
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
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
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
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
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
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
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
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
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
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
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
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
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
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
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
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
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,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';
|