Sha256: aea53a8277a58d62e86825af048512617662a1febb5f056d1dc555f414993a97
Contents?: true
Size: 876 Bytes
Versions: 1
Compression:
Stored size: 876 Bytes
Contents
var React = require('react'), moment = require('moment'); // render a <time> tag. props.timestamp should be a timestamp // that moment can parse, props.format should be one of the // format strings accepted by moment (optional). export default React.createClass({ displayName: 'Time', render() { var timestamp = this.props.timestamp, tsFormat = this.props.tsFormat || '', format = this.props.format || 'lll', m = moment(timestamp, tsFormat), date; switch (this.props.relative) { case 'time from now': date = m.fromNow(); break; case 'calendar time': date = m.calendar(); break; default: date = m.format(format); } return ( <time dateTime={m.format()}>{date}</time> ); } });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
conjur-asset-ui-1.6.0 | app/src/components/generic/time.js |