Skip to content

Commit

Permalink
fixed #12
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcc committed Jun 8, 2017
1 parent 57ebf1b commit eacf53c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions demo/dist/bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/timeago-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ var TimeAgo = function (_React$Component) {
datetime = _props.datetime,
locale = _props.locale;
// cancel all the interval
// timeago.cancel();
// if is live

_timeago2['default'].cancel(this.timeagoDom);
// if is live
if (this.live !== false) {
// live render
if (datetime instanceof Date) {
Expand All @@ -93,7 +93,7 @@ var TimeAgo = function (_React$Component) {
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
_timeago2['default'].cancel();
_timeago2['default'].cancel(this.timeagoDom);
this.timeagoInstance = null;
}
// for render
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "timeago-react",
"version": "1.2.1",
"version": "1.2.2",
"description": "timeago-react is a simple(only 2kb) react component used to format date with `*** time ago` statement. eg: '3 hours ago'.",
"main": "lib/timeago-react.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/timeago-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class TimeAgo extends React.Component {
renderTimeAgo() {
const { live, datetime, locale } = this.props;
// cancel all the interval
// timeago.cancel();
timeago.cancel(this.timeagoDom);
// if is live
if (this.live !== false) {
// live render
Expand All @@ -41,7 +41,7 @@ export default class TimeAgo extends React.Component {
}
// remove
componentWillUnmount() {
timeago.cancel();
timeago.cancel(this.timeagoDom);
this.timeagoInstance = null;
}
// for render
Expand Down

0 comments on commit eacf53c

Please sign in to comment.