react-moment 0.8.0 → 0.8.4
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/.idea/workspace.xml +234 -177
- package/README.md +76 -29
- package/coverage/clover.xml +105 -98
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/index.html +14 -14
- package/coverage/lcov-report/index.jsx.html +70 -34
- package/coverage/lcov-report/objects.js.html +1 -1
- package/coverage/lcov.info +210 -195
- package/dist/index.d.ts +3 -0
- package/dist/index.js +12 -2
- package/package.json +3 -3
- package/src/index.jsx +41 -29
- package/tests/index.jsx +16 -0
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
</h1>
|
|
21
21
|
<div class='clearfix'>
|
|
22
22
|
<div class='fl pad1y space-right2'>
|
|
23
|
-
<span class="strong">
|
|
23
|
+
<span class="strong">81.42% </span>
|
|
24
24
|
<span class="quiet">Statements</span>
|
|
25
|
-
<span class='fraction'>
|
|
25
|
+
<span class='fraction'>92/113</span>
|
|
26
26
|
</div>
|
|
27
27
|
<div class='fl pad1y space-right2'>
|
|
28
|
-
<span class="strong">
|
|
28
|
+
<span class="strong">83.15% </span>
|
|
29
29
|
<span class="quiet">Branches</span>
|
|
30
|
-
<span class='fraction'>
|
|
30
|
+
<span class='fraction'>74/89</span>
|
|
31
31
|
</div>
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
33
|
<span class="strong">84% </span>
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
<span class='fraction'>21/25</span>
|
|
36
36
|
</div>
|
|
37
37
|
<div class='fl pad1y space-right2'>
|
|
38
|
-
<span class="strong">
|
|
38
|
+
<span class="strong">81.42% </span>
|
|
39
39
|
<span class="quiet">Lines</span>
|
|
40
|
-
<span class='fraction'>
|
|
40
|
+
<span class='fraction'>92/113</span>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
</thead>
|
|
61
61
|
<tbody><tr>
|
|
62
62
|
<td class="file high" data-value="index.jsx"><a href="index.jsx.html">index.jsx</a></td>
|
|
63
|
-
<td data-value="
|
|
64
|
-
<td data-value="
|
|
65
|
-
<td data-value="
|
|
66
|
-
<td data-value="
|
|
67
|
-
<td data-value="
|
|
63
|
+
<td data-value="80.37" class="pic high"><div class="chart"><div class="cover-fill" style="width: 80%;"></div><div class="cover-empty" style="width:20%;"></div></div></td>
|
|
64
|
+
<td data-value="80.37" class="pct high">80.37%</td>
|
|
65
|
+
<td data-value="107" class="abs high">86/107</td>
|
|
66
|
+
<td data-value="83.15" class="pct high">83.15%</td>
|
|
67
|
+
<td data-value="89" class="abs high">74/89</td>
|
|
68
68
|
<td data-value="81.82" class="pct high">81.82%</td>
|
|
69
69
|
<td data-value="22" class="abs high">18/22</td>
|
|
70
|
-
<td data-value="
|
|
71
|
-
<td data-value="
|
|
70
|
+
<td data-value="80.37" class="pct high">80.37%</td>
|
|
71
|
+
<td data-value="107" class="abs high">86/107</td>
|
|
72
72
|
</tr>
|
|
73
73
|
|
|
74
74
|
<tr>
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
</div><!-- /wrapper -->
|
|
91
91
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
92
92
|
Code coverage
|
|
93
|
-
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at
|
|
93
|
+
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Thu Nov 01 2018 15:36:57 GMT-0400 (EDT)
|
|
94
94
|
</div>
|
|
95
95
|
</div>
|
|
96
96
|
<script src="prettify.js"></script>
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
</h1>
|
|
21
21
|
<div class='clearfix'>
|
|
22
22
|
<div class='fl pad1y space-right2'>
|
|
23
|
-
<span class="strong">
|
|
23
|
+
<span class="strong">80.37% </span>
|
|
24
24
|
<span class="quiet">Statements</span>
|
|
25
|
-
<span class='fraction'>
|
|
25
|
+
<span class='fraction'>86/107</span>
|
|
26
26
|
</div>
|
|
27
27
|
<div class='fl pad1y space-right2'>
|
|
28
|
-
<span class="strong">
|
|
28
|
+
<span class="strong">83.15% </span>
|
|
29
29
|
<span class="quiet">Branches</span>
|
|
30
|
-
<span class='fraction'>
|
|
30
|
+
<span class='fraction'>74/89</span>
|
|
31
31
|
</div>
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
33
|
<span class="strong">81.82% </span>
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
<span class='fraction'>18/22</span>
|
|
36
36
|
</div>
|
|
37
37
|
<div class='fl pad1y space-right2'>
|
|
38
|
-
<span class="strong">
|
|
38
|
+
<span class="strong">80.37% </span>
|
|
39
39
|
<span class="quiet">Lines</span>
|
|
40
|
-
<span class='fraction'>
|
|
40
|
+
<span class='fraction'>86/107</span>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
@@ -378,7 +378,20 @@
|
|
|
378
378
|
333
|
|
379
379
|
334
|
|
380
380
|
335
|
|
381
|
-
336
|
|
381
|
+
336
|
|
382
|
+
337
|
|
383
|
+
338
|
|
384
|
+
339
|
|
385
|
+
340
|
|
386
|
+
341
|
|
387
|
+
342
|
|
388
|
+
343
|
|
389
|
+
344
|
|
390
|
+
345
|
|
391
|
+
346
|
|
392
|
+
347
|
|
393
|
+
348</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
394
|
+
<span class="cline-any cline-neutral"> </span>
|
|
382
395
|
<span class="cline-any cline-neutral"> </span>
|
|
383
396
|
<span class="cline-any cline-neutral"> </span>
|
|
384
397
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -442,6 +455,8 @@
|
|
|
442
455
|
<span class="cline-any cline-neutral"> </span>
|
|
443
456
|
<span class="cline-any cline-neutral"> </span>
|
|
444
457
|
<span class="cline-any cline-neutral"> </span>
|
|
458
|
+
<span class="cline-any cline-neutral"> </span>
|
|
459
|
+
<span class="cline-any cline-neutral"> </span>
|
|
445
460
|
<span class="cline-any cline-yes">37x</span>
|
|
446
461
|
<span class="cline-any cline-neutral"> </span>
|
|
447
462
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -682,11 +697,20 @@
|
|
|
682
697
|
<span class="cline-any cline-yes">2x</span>
|
|
683
698
|
<span class="cline-any cline-yes">21x</span>
|
|
684
699
|
<span class="cline-any cline-yes">4x</span>
|
|
700
|
+
<span class="cline-any cline-yes">17x</span>
|
|
701
|
+
<span class="cline-any cline-no"> </span>
|
|
702
|
+
<span class="cline-any cline-yes">17x</span>
|
|
703
|
+
<span class="cline-any cline-no"> </span>
|
|
685
704
|
<span class="cline-any cline-neutral"> </span>
|
|
686
705
|
<span class="cline-any cline-yes">17x</span>
|
|
687
706
|
<span class="cline-any cline-neutral"> </span>
|
|
688
707
|
<span class="cline-any cline-neutral"> </span>
|
|
689
708
|
<span class="cline-any cline-yes">38x</span>
|
|
709
|
+
<span class="cline-any cline-no"> </span>
|
|
710
|
+
<span class="cline-any cline-no"> </span>
|
|
711
|
+
<span class="cline-any cline-neutral"> </span>
|
|
712
|
+
<span class="cline-any cline-neutral"> </span>
|
|
713
|
+
<span class="cline-any cline-yes">38x</span>
|
|
690
714
|
<span class="cline-any cline-yes">38x</span>
|
|
691
715
|
<span class="cline-any cline-neutral"> </span>
|
|
692
716
|
<span class="cline-any cline-yes">38x</span>
|
|
@@ -716,6 +740,7 @@
|
|
|
716
740
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React from 'react';
|
|
717
741
|
import PropTypes from 'prop-types';
|
|
718
742
|
import moment from 'moment';
|
|
743
|
+
import 'moment-duration-format';
|
|
719
744
|
import { objectKeyFilter } from './objects';
|
|
720
745
|
|
|
721
746
|
const dateTypes = [
|
|
@@ -737,31 +762,33 @@ const calendarTypes = [
|
|
|
737
762
|
|
|
738
763
|
export default class Moment extends React.Component {
|
|
739
764
|
static propTypes = {
|
|
740
|
-
element:
|
|
741
|
-
date:
|
|
742
|
-
parse:
|
|
743
|
-
format:
|
|
744
|
-
add:
|
|
745
|
-
subtract:
|
|
746
|
-
ago:
|
|
747
|
-
fromNow:
|
|
748
|
-
fromNowDuring:
|
|
749
|
-
from:
|
|
750
|
-
toNow:
|
|
751
|
-
to:
|
|
752
|
-
calendar:
|
|
753
|
-
unix:
|
|
754
|
-
utc:
|
|
755
|
-
tz:
|
|
756
|
-
withTitle:
|
|
757
|
-
titleFormat:
|
|
758
|
-
locale:
|
|
759
|
-
interval:
|
|
760
|
-
diff:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
+
element: PropTypes.any,
|
|
766
|
+
date: PropTypes.oneOfType(dateTypes),
|
|
767
|
+
parse: PropTypes.oneOfType(parseTypes),
|
|
768
|
+
format: PropTypes.string,
|
|
769
|
+
add: PropTypes.object,
|
|
770
|
+
subtract: PropTypes.object,
|
|
771
|
+
ago: PropTypes.bool,
|
|
772
|
+
fromNow: PropTypes.bool,
|
|
773
|
+
fromNowDuring: PropTypes.number,
|
|
774
|
+
from: PropTypes.oneOfType(dateTypes),
|
|
775
|
+
toNow: PropTypes.bool,
|
|
776
|
+
to: PropTypes.oneOfType(dateTypes),
|
|
777
|
+
calendar: PropTypes.oneOfType(calendarTypes),
|
|
778
|
+
unix: PropTypes.bool,
|
|
779
|
+
utc: PropTypes.bool,
|
|
780
|
+
tz: PropTypes.string,
|
|
781
|
+
withTitle: PropTypes.bool,
|
|
782
|
+
titleFormat: PropTypes.string,
|
|
783
|
+
locale: PropTypes.string,
|
|
784
|
+
interval: PropTypes.number,
|
|
785
|
+
diff: PropTypes.oneOfType(dateTypes),
|
|
786
|
+
duration: PropTypes.oneOfType(dateTypes),
|
|
787
|
+
durationFromNow: PropTypes.bool,
|
|
788
|
+
unit: PropTypes.string,
|
|
789
|
+
decimal: PropTypes.bool,
|
|
790
|
+
filter: PropTypes.func,
|
|
791
|
+
onChange: PropTypes.func
|
|
765
792
|
};
|
|
766
793
|
|
|
767
794
|
static defaultProps = {
|
|
@@ -987,7 +1014,7 @@ export default class Moment extends React.Component {
|
|
|
987
1014
|
props = props || <span class="branch-1 cbranch-no" title="branch not covered" >this.props;</span>
|
|
988
1015
|
const {
|
|
989
1016
|
fromNow, fromNowDuring, from, add, subtract, toNow, to, ago,
|
|
990
|
-
calendar, diff, unit, decimal
|
|
1017
|
+
calendar, diff, duration, durationFromNow, unit, decimal
|
|
991
1018
|
} = props;
|
|
992
1019
|
|
|
993
1020
|
let { format } = props;
|
|
@@ -1017,9 +1044,18 @@ export default class Moment extends React.Component {
|
|
|
1017
1044
|
content = datetime.calendar(null, calendar);
|
|
1018
1045
|
} else if (diff) {
|
|
1019
1046
|
content = datetime.diff(diff, unit, decimal);
|
|
1047
|
+
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (duration) {
|
|
1048
|
+
<span class="cstat-no" title="statement not covered" > content = datetime.diff(duration);</span>
|
|
1049
|
+
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (durationFromNow) {
|
|
1050
|
+
<span class="cstat-no" title="statement not covered" > content = moment().diff(datetime);</span>
|
|
1020
1051
|
} else {
|
|
1021
1052
|
content = datetime.toString();
|
|
1022
1053
|
}
|
|
1054
|
+
|
|
1055
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (duration || durationFromNow) {
|
|
1056
|
+
<span class="cstat-no" title="statement not covered" > content = moment.duration(content);</span>
|
|
1057
|
+
<span class="cstat-no" title="statement not covered" > content = content.format(format);</span>
|
|
1058
|
+
}
|
|
1023
1059
|
|
|
1024
1060
|
const filter = Moment.globalFilter || this.props.filter;
|
|
1025
1061
|
content = filter(content);
|
|
@@ -1054,7 +1090,7 @@ export default class Moment extends React.Component {
|
|
|
1054
1090
|
</div><!-- /wrapper -->
|
|
1055
1091
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1056
1092
|
Code coverage
|
|
1057
|
-
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at
|
|
1093
|
+
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Thu Nov 01 2018 15:36:57 GMT-0400 (EDT)
|
|
1058
1094
|
</div>
|
|
1059
1095
|
</div>
|
|
1060
1096
|
<script src="prettify.js"></script>
|
|
@@ -151,7 +151,7 @@ export function objectKeyFilter(obj1, obj2) {
|
|
|
151
151
|
</div><!-- /wrapper -->
|
|
152
152
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
153
153
|
Code coverage
|
|
154
|
-
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at
|
|
154
|
+
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Thu Nov 01 2018 15:36:57 GMT-0400 (EDT)
|
|
155
155
|
</div>
|
|
156
156
|
</div>
|
|
157
157
|
<script src="prettify.js"></script>
|