JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1258
  • Score
    100M100P100Q97309F
  • License MIT

react component for rendering formatted timestamps

Package Exports

  • react-time

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-time) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-time

Component for React to render relative and/or formatted dates by using <time> HTML5 element and preserving machine readable format in datetime attribute.

Installation

% npm install react-time

Usage

var Timestamp = require('react-time');

MyComponent = React.createClass({
  render: function() {
    var now = new Date(),
        wasDate = new Date("Thu Jul 18 2013 15:48:59 GMT+0400");
    return (
      <div>
        <p>Today is <Timestamp value={now} format="%Y/%m/%d" /></p>
        <p>This was <Timestamp value={wasDate} relative /></p>
      </div>
    );
  }
});