How to use the react-timeago/lib/formatters/buildFormatter function in react-timeago

To help you get started, we’ve selected a few react-timeago examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tronscan / tronscan-frontend / src / components / common / TimeAgoI18N.js View on Github external
const TimeAgoI18N = ({date, activeLanguage}) => {
    const formatter = buildFormatter(timeLanguages[activeLanguage]);
    return ;
};
github nowyasimi / no8am / no8am / static / js / filters / GlobalFilters.tsx View on Github external
public render() {
        const formatter = buildFormatter(englishStrings);

        const cacheTime = new Date();

        return (
            <div>
                
                </div>
        );
    }
}
github fuhcm / fptu-app / src / app / modules / search / Search.js View on Github external
Row,
  Col,
  Statistic,
  Icon,
  Card,
} from "antd";
import Helmet from "react-helmet-async";
import Highlighter from "react-highlight-words";
import { debounce } from "debounce";
import styled from "styled-components";

import TimeAgo from "react-timeago";
import viStrings from "react-timeago/lib/language-strings/vi";
import buildFormatter from "react-timeago/lib/formatters/buildFormatter";

const formatter = buildFormatter(viStrings);

const { Content } = Layout;
const Search = Input.Search;

const ConfessContent = styled.div`
  white-space: pre-line;
`;

class SearchPage extends PureComponent {
  state = {
    initLoading  : true,
    loading      : false,
    data         : [],
    list         : [],
    isSearchMode : false,
    searchKeyword: "",
github ICTU / quality-report / frontend / js / components / last_built_label.js View on Github external
render() {
        const formatter = buildFormatter(dutchStrings);

        var year = this.props.latest_change_date ?
                   parseInt(this.props.latest_change_date.substr(0, 4), 10) : 0;

        if (year &gt; 2000) {
            return (
                <span>
                    gewijzigd 
                </span>
            );
        }
        return '';
    }
}
github bukinoshita / hackdisrupt / pages / polls / index.js View on Github external
render() {
    const formatter = buildFormatter(brazilianStrings)
    const { polls } = this.state
    const token = getCookie('hackdisrupt')

    const createNewBtn = token ? (
      
        <button size="small">criar uma poll</button>
      
    ) : (
      undefined
    )

    const list = polls ? (
      polls.map(({ _id, owner, createdAt, title, description }) =&gt; {
        return (
          <li>
            </li>
github huacnlee / bluedoc / app / javascript / bluebox / timeago / index.js View on Github external
month: '大约 1 个月',
  months: '%d 月',
  year: '大约 1 年',
  years: '%d 年',

  wordSeparator: ''
};

const metaLocale = document.querySelector('meta[name=locale]');
let locale = "en";
if (metaLocale) {
  locale = metaLocale.getAttribute("content");
}
let formatter;
if (locale === "zh-CN") {
  formatter = buildFormatter(cnStrings)
} else {
  formatter = buildFormatter(enStrings)
}



export class Timeago extends React.Component {
  render() {
    let { value, time } = this.props;
    if (!value) {
      value = time;
    }

    return 
  }
}
github fuhcm / fptu-app / src / app / modules / change / Change.js View on Github external
Layout,
  message,
  Progress,
  List,
  Skeleton,
  Card,
} from "antd";
import GoogleLogin from "react-google-login";

import TimeAgo from "react-timeago";
import viStrings from "react-timeago/lib/language-strings/vi";
import buildFormatter from "react-timeago/lib/formatters/buildFormatter";

const { Content } = Layout;

const formatter = buildFormatter(viStrings);

function ChangeForm() {
  const [loading, setLoading] = useState(false);
  const [isSigned, setIsSigned] = useState(false);
  const [signList, setSignList] = useState([]);
  const [count, setCount] = useState(0);

  useEffect(() => {
    let fake = null;

    setLoading(true);
    FPTUSDK.change
      .getSignList()
      .then(data => {
        setSignList(data.list);
        setCount(data.count || 0);
github fuhcm / fptu-app / src / app / modules / admincp / AdminCP.js View on Github external
Col,
  Card,
  Icon,
  Statistic,
  Popconfirm,
} from "antd";
import TextArea from "antd/lib/input/TextArea";
import Helmet from "react-helmet-async";
import LocalStorageUtils from "@utils/browser/LocalStorage";
import styled from "styled-components";

import TimeAgo from "react-timeago";
import viStrings from "react-timeago/lib/language-strings/vi";
import buildFormatter from "react-timeago/lib/formatters/buildFormatter";

const formatter = buildFormatter(viStrings);

const { Content } = Layout;

const stepLoad = 10;

const ConfessContent = styled.div`
  white-space: pre-line;
`;

class AdminCP extends Component {
  state = {
    numLoad    : stepLoad,
    initLoading: true,
    loading    : false,
    data       : [],
    list       : [],
github huacnlee / bluedoc / app / javascript / bluebox / timeago / index.js View on Github external
year: '大约 1 年',
  years: '%d 年',

  wordSeparator: ''
};

const metaLocale = document.querySelector('meta[name=locale]');
let locale = "en";
if (metaLocale) {
  locale = metaLocale.getAttribute("content");
}
let formatter;
if (locale === "zh-CN") {
  formatter = buildFormatter(cnStrings)
} else {
  formatter = buildFormatter(enStrings)
}



export class Timeago extends React.Component {
  render() {
    let { value, time } = this.props;
    if (!value) {
      value = time;
    }

    return 
  }
}

react-timeago

A simple Time-Ago component for ReactJs

MIT
Latest version published 8 months ago

Package Health Score

71 / 100
Full package analysis