react-moment 0.7.5 → 0.7.9
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/inspectionProfiles/Project_Default.xml +0 -1
- package/.idea/typescript-compiler.xml +6 -0
- package/.idea/workspace.xml +151 -102
- package/README.md +2 -1
- package/coverage/clover.xml +95 -94
- package/coverage/coverage-final.json +2 -2
- package/coverage/lcov-report/index.html +14 -14
- package/coverage/lcov-report/index.jsx.html +85 -79
- package/coverage/lcov-report/objects.js.html +7 -7
- package/coverage/lcov.info +203 -196
- package/dist/index.d.ts +62 -24
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/index.jsx +2 -2
- package/tests/index.jsx +18 -0
package/tests/index.jsx
CHANGED
|
@@ -109,6 +109,24 @@ describe('react-moment', () => {
|
|
|
109
109
|
expect(ReactDOM.findDOMNode(date).innerHTML).toEqual(expected);
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
+
it('fromNowDuring', () => {
|
|
113
|
+
const twoHoursAgo = moment().add(-2, 'hours');
|
|
114
|
+
const hour = 1e3 * 60 * 60;
|
|
115
|
+
const TWO_HOURS_AGO_ISO = twoHoursAgo.format();
|
|
116
|
+
|
|
117
|
+
let date = TestUtils.renderIntoDocument(
|
|
118
|
+
<Moment format="YYYY-MM-DD HH:mm" fromNowDuring={3 * hour}>{TWO_HOURS_AGO_ISO}</Moment>
|
|
119
|
+
);
|
|
120
|
+
let expected = twoHoursAgo.fromNow();
|
|
121
|
+
expect(ReactDOM.findDOMNode(date).innerHTML).toEqual(expected);
|
|
122
|
+
|
|
123
|
+
date = TestUtils.renderIntoDocument(
|
|
124
|
+
<Moment format="YYYY-MM-DD HH:mm" fromNowDuring={1 * hour}>{TWO_HOURS_AGO_ISO}</Moment>
|
|
125
|
+
);
|
|
126
|
+
expected = twoHoursAgo.format('YYYY-MM-DD HH:mm');
|
|
127
|
+
expect(ReactDOM.findDOMNode(date).innerHTML).toEqual(expected);
|
|
128
|
+
});
|
|
129
|
+
|
|
112
130
|
it('from', () => {
|
|
113
131
|
let date = TestUtils.renderIntoDocument(
|
|
114
132
|
<Moment from="2016-09-20T12:00">{DATE_STRING}</Moment>
|