Skip to content

Instantly share code, notes, and snippets.

View AleksandrChernyavenko's full-sized avatar

Aleksandr Chernyavenko AleksandrChernyavenko

  • Kharkiv, Ukraine
View GitHub Profile
@AleksandrChernyavenko
AleksandrChernyavenko / TimeAgo.jsx
Last active May 2, 2018 14:33 — forked from johndavedecano/TimeAgo.jsx
TimeAgo component using date-fns
import React, {Component} from 'react';
import differenceInSeconds from 'date-fns/difference_in_seconds';
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
class TimeAgo extends Component {
componentDidMount() {
if (this.props.isLive) {
this.updateTime();
}