How to use the react-intl.FormattedRelative function in react-intl

To help you get started, we’ve selected a few react-intl 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 LLK / scratch-www / src / views / preview / comment / comment.jsx View on Github external
const React = require('react');
const PropTypes = require('prop-types');
const bindAll = require('lodash.bindall');
const classNames = require('classnames');

const FlexRow = require('../../../components/flex-row/flex-row.jsx');
const Avatar = require('../../../components/avatar/avatar.jsx');
const EmojiText = require('../../../components/emoji-text/emoji-text.jsx');
const FormattedRelative = require('react-intl').FormattedRelative;
const FormattedMessage = require('react-intl').FormattedMessage;
const ComposeComment = require('./compose-comment.jsx');
const DeleteCommentModal = require('../../../components/modal/comments/delete-comment.jsx');
const ReportCommentModal = require('../../../components/modal/comments/report-comment.jsx');
const decorateText = require('../../../lib/decorate-text.jsx');

require('./comment.scss');

class Comment extends React.Component {
    constructor (props) {
        super(props);
        bindAll(this, [
            'handleDelete',
            'handleCancelDelete',
            'handleConfirmDelete',
            'handleReport',
github mozilla / learning.mozilla.org / pages / makes.jsx View on Github external
var React = require('react');
var request = require('superagent');
var moment = require('moment');
var urlTemplate = require('url-template');
var FormattedRelative = require('react-intl').FormattedRelative;
var FormattedMessage = require('react-intl').FormattedMessage;

var withTeachAPI = require('../hoc/with-teach-api.jsx');

var config = require('../config/config');

var makesMetadataURL = urlTemplate.parse(config.MAKE_METADATA_URL);

var Make = React.createClass({
  render: function() {
    var makeTypeClass = "make " + this.props.type;
    var thumbnailStyle = (this.props.thumbnail) ? {"backgroundImage": "url(" + this.props.thumbnail + ")"}
                                                 : {
                                                   "backgroundImage": "url(/img/pages/me/svg/icon-placeholder.svg)",
                                                   "backgroundSize": "11rem auto"};
github ianobermiller / nuclearmail / src / RelativeDate.js View on Github external
/** @flow */

const IntlMixin = require('react-intl').IntlMixin;
const FormattedRelative = require('react-intl').FormattedRelative;
const {Component, PropTypes} = require('react');

const LONG_DATE_TIME_FORMAT = {
  year: 'numeric',
  month: 'long',
  day: 'numeric',
  hour: 'numeric',
  minute: '2-digit',
};

class RelativeDate extends Component {
  static propTypes = {
    date: PropTypes.instanceOf(Date).isRequired,

    style: PropTypes.object,
  };
github este / este / src / native / app / components / formatted.js View on Github external
style={style}
            >
              {Children.toArray(nodes)}
            
          }
        
      );
    }

  };

export const FormattedDate = native(reactIntl.FormattedDate);
export const FormattedMessage = native(reactIntl.FormattedMessage);
export const FormattedNumber = native(reactIntl.FormattedNumber);
export const FormattedPlural = native(reactIntl.FormattedPlural);
export const FormattedRelative = native(reactIntl.FormattedRelative);
export const FormattedTime = native(reactIntl.FormattedTime);
github LLK / scratch-www / src / components / activity / activity.jsx View on Github external
var React = require('react');
var ReactIntl = require('react-intl');
var defineMessages = ReactIntl.defineMessages;
var FormattedMessage = ReactIntl.FormattedMessage;
var FormattedRelative = ReactIntl.FormattedRelative;
var injectIntl = ReactIntl.injectIntl;

var Box = require('../box/box.jsx');

require('./activity.scss');

var defaultMessages = defineMessages({
    whatsHappening: {
        id: 'general.whatsHappening'
    }
});

var Activity = React.createClass({
    type: 'Activity',
    propTypes: {
        items: React.PropTypes.array
github openaq / openaq.org / app / assets / scripts / components / locationDetailItem.js View on Github external
var React = require('react');
var ReactIntl = require('react-intl');

var config = require('../config');

var IntlMixin = ReactIntl.IntlMixin;
var FormattedRelative = ReactIntl.FormattedRelative;
var FormattedMessage = ReactIntl.FormattedMessage;

var DetailItem = React.createClass({

  mixins: [IntlMixin],

  propTypes: {
    location: React.PropTypes.object
  },

  getCSVURL: function (l) {
    return config.apiURL + 'measurements?format=csv&location=' + l.location;
  },

  render: function () {
    var l = this.props.location;
github LLK / scratch-www / src / components / social-message / social-message.jsx View on Github external
var classNames = require('classnames');
var FormattedRelative = require('react-intl').FormattedRelative;
var React = require('react');

var FlexRow = require('../flex-row/flex-row.jsx');

require('./social-message.scss');

var SocialMessage = React.createClass({
    type: 'SocialMessage',
    propTypes: {
        as: React.PropTypes.string,
        datetime: React.PropTypes.string.isRequired,
        iconSrc: React.PropTypes.string,
        iconAlt: React.PropTypes.string,
        imgClassName: React.PropTypes.string
    },
    getDefaultProps: function () {