react-timeago: Warning: Unknown prop `now` on

Seeing this warning coming up

warning.js:36 Warning: Unknown prop `now` on <time> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 27
  • Comments: 22 (6 by maintainers)

Most upvoted comments

My bad. I just added that prop type but I forgot to remove it from the list of forwarded props. I’ll fix it in a new patch release.

Could you please publish the version with the fix? Thanks

I’ve confirmed that switching to version 3.2.1 in your package.json solves the javascript error. The only difference in this version from 3.3.0 is the “now” property on the time tag.

"react-timeago": "3.2.1"

Hi , so , I will go to a stupid solution if this issue will not solved , and it will be :

     class WrapperTimeAgo extends Component {
  
        componentDidMount() {
          console.clear(); // <== 😅 😂 😂 
        }

         render() {
             return <TimeAgo {...this.props} />
          }

     }

Ok. I’ll put together a PR shortly.

Here is an alternative, as this repo has not upgraded yet: use moment.

Something like:

import moment from 'moment'
...
<div>{moment(yourDate).fromNow()}</div>

It’s not live, but it will refresh when the component re-renders.

Yep @dinomite, I forked the project for exactly that reason (publish automation). I need fixes to actually get published. 😃

I set up CircleCI to automatically publish tagged releases for me. Feel free to use it if you want (it already includes the fix for this issue).

npm i -S @jshimko/react-time-ago 

https://github.com/jshimko/react-time-ago

@ocolot Not practical for most people as Moment.js is HUGE.

@ocolot Yeah… the library just gets published with the fix? It was merged into master 11 days ago.

Here is a fix for this. Replace node_modules/lib/index.js with this one. Until an official fix is published …

Btw, I simply replaced this.props.now() with new Date() here and here, and removed it from defaultProps. See also (https://github.com/nmn/react-timeago/issues/85) and (https://github.com/nmn/react-timeago/pull/86).

fixed and released. Sorry for the crazy delay.

I downgraded to 3.2.1 and the warning doesn’t show there.