@hig/timestamp
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
@@ -34,105 +34,136 @@ import { css, cx } from 'emotion'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var pluralize = function pluralize(word, count) { | ||
return count === 1 ? word : word + "s"; | ||
}; | ||
var Timestamp = function Timestamp(props) { | ||
var getTimestampSequence = function getTimestampSequence(distance, ellapsedDescriptor) { | ||
var timeDescriptors = props.timeDescriptors, | ||
timestampSequence = props.timestampSequence, | ||
wordSpace = props.wordSpace; | ||
var userTimestamp = void 0; | ||
var Timestamp = function (_Component) { | ||
_inherits(Timestamp, _Component); | ||
switch (timestampSequence) { | ||
case "acb": | ||
userTimestamp = wordSpace ? distance + " " + timeDescriptors.ago + " " + ellapsedDescriptor : "" + distance + timeDescriptors.ago + ellapsedDescriptor; | ||
break; | ||
case "bac": | ||
userTimestamp = wordSpace ? ellapsedDescriptor + " " + distance + " " + timeDescriptors.ago : "" + ellapsedDescriptor + distance + timeDescriptors.ago; | ||
break; | ||
case "bca": | ||
userTimestamp = wordSpace ? ellapsedDescriptor + " " + timeDescriptors.ago + " " + distance : "" + ellapsedDescriptor + timeDescriptors.ago + distance; | ||
break; | ||
case "cab": | ||
userTimestamp = wordSpace ? timeDescriptors.ago + " " + distance + " " + ellapsedDescriptor : "" + timeDescriptors.ago + distance + ellapsedDescriptor; | ||
break; | ||
case "cba": | ||
userTimestamp = wordSpace ? timeDescriptors.ago + " " + ellapsedDescriptor + " " + distance : "" + timeDescriptors.ago + ellapsedDescriptor + distance; | ||
break; | ||
default: | ||
userTimestamp = wordSpace ? distance + " " + ellapsedDescriptor + " " + timeDescriptors.ago : "" + distance + ellapsedDescriptor + timeDescriptors.ago; | ||
function Timestamp() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, Timestamp); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return userTimestamp; | ||
}; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Timestamp.__proto__ || Object.getPrototypeOf(Timestamp)).call.apply(_ref, [this].concat(args))), _this), _this.getTimestampSequence = function (distance, ellapsedDescriptor) { | ||
var _this$props = _this.props, | ||
timeDescriptors = _this$props.timeDescriptors, | ||
timestampSequence = _this$props.timestampSequence, | ||
wordSpace = _this$props.wordSpace; | ||
var humanizeTimestamp = function humanizeTimestamp() { | ||
var plural = props.plural, | ||
timeDescriptors = props.timeDescriptors, | ||
timestamp = props.timestamp; | ||
var userTimestamp = void 0; | ||
var asSeconds = Date.parse(timestamp) / 1000; // TODO: handle future timestamps, or bad input? | ||
var nowAsSeconds = new Date().valueOf() / 1000; | ||
switch (timestampSequence) { | ||
case "acb": | ||
userTimestamp = wordSpace ? distance + " " + timeDescriptors.ago + " " + ellapsedDescriptor : "" + distance + timeDescriptors.ago + ellapsedDescriptor; | ||
break; | ||
case "bac": | ||
userTimestamp = wordSpace ? ellapsedDescriptor + " " + distance + " " + timeDescriptors.ago : "" + ellapsedDescriptor + distance + timeDescriptors.ago; | ||
break; | ||
case "bca": | ||
userTimestamp = wordSpace ? ellapsedDescriptor + " " + timeDescriptors.ago + " " + distance : "" + ellapsedDescriptor + timeDescriptors.ago + distance; | ||
break; | ||
case "cab": | ||
userTimestamp = wordSpace ? timeDescriptors.ago + " " + distance + " " + ellapsedDescriptor : "" + timeDescriptors.ago + distance + ellapsedDescriptor; | ||
break; | ||
case "cba": | ||
userTimestamp = wordSpace ? timeDescriptors.ago + " " + ellapsedDescriptor + " " + distance : "" + timeDescriptors.ago + ellapsedDescriptor + distance; | ||
break; | ||
default: | ||
userTimestamp = wordSpace ? distance + " " + ellapsedDescriptor + " " + timeDescriptors.ago : "" + distance + ellapsedDescriptor + timeDescriptors.ago; | ||
} | ||
var timeDifference = nowAsSeconds - asSeconds; | ||
var distance = void 0; | ||
var ellapsedDescriptor = void 0; | ||
return userTimestamp; | ||
}, _this.humanizeTimestamp = function () { | ||
var _this$props2 = _this.props, | ||
plural = _this$props2.plural, | ||
timeDescriptors = _this$props2.timeDescriptors, | ||
timestamp = _this$props2.timestamp; | ||
if (timeDifference < 60) { | ||
distance = Math.round(timeDifference); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.second, distance) : timeDescriptors.second; | ||
} else if (timeDifference < 60 * 60) { | ||
// 1 hour | ||
distance = Math.round(timeDifference / 60); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.minute, distance) : timeDescriptors.minute; | ||
} else if (timeDifference < 60 * 60 * 24) { | ||
// 1 day | ||
distance = Math.round(timeDifference / (60 * 60)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.hour, distance) : timeDescriptors.hour; | ||
} else if (timeDifference < 60 * 60 * 24 * 7) { | ||
// 1 week | ||
distance = Math.round(timeDifference / (60 * 60 * 24)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.day, distance) : timeDescriptors.day; | ||
} else if (timeDifference < 60 * 60 * 24 * (365 / 12)) { | ||
// 1 month | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * 7)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.week, distance) : timeDescriptors.week; | ||
} else if (timeDifference < 60 * 60 * 24 * 30 * 12) { | ||
// # 1 year | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * (365 / 12))); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.month, distance) : timeDescriptors.month; | ||
} else { | ||
// More than 1 year | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * 365)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.year, distance) : timeDescriptors.year; | ||
} | ||
var asSeconds = Date.parse(timestamp) / 1000; // TODO: handle future timestamps, or bad input? | ||
var nowAsSeconds = new Date().valueOf() / 1000; | ||
return getTimestampSequence(distance, ellapsedDescriptor); | ||
}; | ||
var timeDifference = nowAsSeconds - asSeconds; | ||
var distance = void 0; | ||
var ellapsedDescriptor = void 0; | ||
return React.createElement( | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref) { | ||
var resolvedRoles = _ref.resolvedRoles, | ||
metadata = _ref.metadata; | ||
if (timeDifference < 60) { | ||
distance = Math.round(timeDifference); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.second, distance) : timeDescriptors.second; | ||
} else if (timeDifference < 60 * 60) { | ||
// 1 hour | ||
distance = Math.round(timeDifference / 60); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.minute, distance) : timeDescriptors.minute; | ||
} else if (timeDifference < 60 * 60 * 24) { | ||
// 1 day | ||
distance = Math.round(timeDifference / (60 * 60)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.hour, distance) : timeDescriptors.hour; | ||
} else if (timeDifference < 60 * 60 * 24 * 7) { | ||
// 1 week | ||
distance = Math.round(timeDifference / (60 * 60 * 24)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.day, distance) : timeDescriptors.day; | ||
} else if (timeDifference < 60 * 60 * 24 * (365 / 12)) { | ||
// 1 month | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * 7)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.week, distance) : timeDescriptors.week; | ||
} else if (timeDifference < 60 * 60 * 24 * 30 * 12) { | ||
// # 1 year | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * (365 / 12))); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.month, distance) : timeDescriptors.month; | ||
} else { | ||
// More than 1 year | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * 365)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.year, distance) : timeDescriptors.year; | ||
} | ||
var customStylesheet = props.stylesheet, | ||
otherProps = _objectWithoutProperties(props, ["stylesheet"]); | ||
return _this.getTimestampSequence(distance, ellapsedDescriptor); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
var className = otherProps.className; | ||
_createClass(Timestamp, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this2 = this; | ||
var styles = stylesheet({ stylesheet: customStylesheet }, resolvedRoles, metadata.colorSchemeId); | ||
return React.createElement( | ||
"div", | ||
{ className: cx(css(styles.timestamp), className) }, | ||
humanizeTimestamp() | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref2) { | ||
var resolvedRoles = _ref2.resolvedRoles, | ||
metadata = _ref2.metadata; | ||
var _props = _this2.props, | ||
customStylesheet = _props.stylesheet, | ||
otherProps = _objectWithoutProperties(_props, ["stylesheet"]); | ||
var className = otherProps.className; | ||
var styles = stylesheet({ stylesheet: customStylesheet }, resolvedRoles, metadata.colorSchemeId); | ||
return React.createElement( | ||
"div", | ||
{ className: cx(css(styles.timestamp), className) }, | ||
_this2.humanizeTimestamp() | ||
); | ||
} | ||
); | ||
} | ||
); | ||
}; | ||
}]); | ||
Timestamp.displayName = "Timestamp"; | ||
return Timestamp; | ||
}(Component); | ||
@@ -178,3 +209,2 @@ Timestamp.propTypes = { | ||
}; | ||
Timestamp.defaultProps = { | ||
@@ -181,0 +211,0 @@ plural: true, |
@@ -7,3 +7,4 @@ 'use strict'; | ||
var React = _interopDefault(require('react')); | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
@@ -41,105 +42,136 @@ var emotion = require('emotion'); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var pluralize = function pluralize(word, count) { | ||
return count === 1 ? word : word + "s"; | ||
}; | ||
var Timestamp = function Timestamp(props) { | ||
var getTimestampSequence = function getTimestampSequence(distance, ellapsedDescriptor) { | ||
var timeDescriptors = props.timeDescriptors, | ||
timestampSequence = props.timestampSequence, | ||
wordSpace = props.wordSpace; | ||
var userTimestamp = void 0; | ||
var Timestamp = function (_Component) { | ||
_inherits(Timestamp, _Component); | ||
switch (timestampSequence) { | ||
case "acb": | ||
userTimestamp = wordSpace ? distance + " " + timeDescriptors.ago + " " + ellapsedDescriptor : "" + distance + timeDescriptors.ago + ellapsedDescriptor; | ||
break; | ||
case "bac": | ||
userTimestamp = wordSpace ? ellapsedDescriptor + " " + distance + " " + timeDescriptors.ago : "" + ellapsedDescriptor + distance + timeDescriptors.ago; | ||
break; | ||
case "bca": | ||
userTimestamp = wordSpace ? ellapsedDescriptor + " " + timeDescriptors.ago + " " + distance : "" + ellapsedDescriptor + timeDescriptors.ago + distance; | ||
break; | ||
case "cab": | ||
userTimestamp = wordSpace ? timeDescriptors.ago + " " + distance + " " + ellapsedDescriptor : "" + timeDescriptors.ago + distance + ellapsedDescriptor; | ||
break; | ||
case "cba": | ||
userTimestamp = wordSpace ? timeDescriptors.ago + " " + ellapsedDescriptor + " " + distance : "" + timeDescriptors.ago + ellapsedDescriptor + distance; | ||
break; | ||
default: | ||
userTimestamp = wordSpace ? distance + " " + ellapsedDescriptor + " " + timeDescriptors.ago : "" + distance + ellapsedDescriptor + timeDescriptors.ago; | ||
function Timestamp() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, Timestamp); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return userTimestamp; | ||
}; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Timestamp.__proto__ || Object.getPrototypeOf(Timestamp)).call.apply(_ref, [this].concat(args))), _this), _this.getTimestampSequence = function (distance, ellapsedDescriptor) { | ||
var _this$props = _this.props, | ||
timeDescriptors = _this$props.timeDescriptors, | ||
timestampSequence = _this$props.timestampSequence, | ||
wordSpace = _this$props.wordSpace; | ||
var humanizeTimestamp = function humanizeTimestamp() { | ||
var plural = props.plural, | ||
timeDescriptors = props.timeDescriptors, | ||
timestamp = props.timestamp; | ||
var userTimestamp = void 0; | ||
var asSeconds = Date.parse(timestamp) / 1000; // TODO: handle future timestamps, or bad input? | ||
var nowAsSeconds = new Date().valueOf() / 1000; | ||
switch (timestampSequence) { | ||
case "acb": | ||
userTimestamp = wordSpace ? distance + " " + timeDescriptors.ago + " " + ellapsedDescriptor : "" + distance + timeDescriptors.ago + ellapsedDescriptor; | ||
break; | ||
case "bac": | ||
userTimestamp = wordSpace ? ellapsedDescriptor + " " + distance + " " + timeDescriptors.ago : "" + ellapsedDescriptor + distance + timeDescriptors.ago; | ||
break; | ||
case "bca": | ||
userTimestamp = wordSpace ? ellapsedDescriptor + " " + timeDescriptors.ago + " " + distance : "" + ellapsedDescriptor + timeDescriptors.ago + distance; | ||
break; | ||
case "cab": | ||
userTimestamp = wordSpace ? timeDescriptors.ago + " " + distance + " " + ellapsedDescriptor : "" + timeDescriptors.ago + distance + ellapsedDescriptor; | ||
break; | ||
case "cba": | ||
userTimestamp = wordSpace ? timeDescriptors.ago + " " + ellapsedDescriptor + " " + distance : "" + timeDescriptors.ago + ellapsedDescriptor + distance; | ||
break; | ||
default: | ||
userTimestamp = wordSpace ? distance + " " + ellapsedDescriptor + " " + timeDescriptors.ago : "" + distance + ellapsedDescriptor + timeDescriptors.ago; | ||
} | ||
var timeDifference = nowAsSeconds - asSeconds; | ||
var distance = void 0; | ||
var ellapsedDescriptor = void 0; | ||
return userTimestamp; | ||
}, _this.humanizeTimestamp = function () { | ||
var _this$props2 = _this.props, | ||
plural = _this$props2.plural, | ||
timeDescriptors = _this$props2.timeDescriptors, | ||
timestamp = _this$props2.timestamp; | ||
if (timeDifference < 60) { | ||
distance = Math.round(timeDifference); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.second, distance) : timeDescriptors.second; | ||
} else if (timeDifference < 60 * 60) { | ||
// 1 hour | ||
distance = Math.round(timeDifference / 60); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.minute, distance) : timeDescriptors.minute; | ||
} else if (timeDifference < 60 * 60 * 24) { | ||
// 1 day | ||
distance = Math.round(timeDifference / (60 * 60)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.hour, distance) : timeDescriptors.hour; | ||
} else if (timeDifference < 60 * 60 * 24 * 7) { | ||
// 1 week | ||
distance = Math.round(timeDifference / (60 * 60 * 24)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.day, distance) : timeDescriptors.day; | ||
} else if (timeDifference < 60 * 60 * 24 * (365 / 12)) { | ||
// 1 month | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * 7)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.week, distance) : timeDescriptors.week; | ||
} else if (timeDifference < 60 * 60 * 24 * 30 * 12) { | ||
// # 1 year | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * (365 / 12))); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.month, distance) : timeDescriptors.month; | ||
} else { | ||
// More than 1 year | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * 365)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.year, distance) : timeDescriptors.year; | ||
} | ||
var asSeconds = Date.parse(timestamp) / 1000; // TODO: handle future timestamps, or bad input? | ||
var nowAsSeconds = new Date().valueOf() / 1000; | ||
return getTimestampSequence(distance, ellapsedDescriptor); | ||
}; | ||
var timeDifference = nowAsSeconds - asSeconds; | ||
var distance = void 0; | ||
var ellapsedDescriptor = void 0; | ||
return React.createElement( | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref) { | ||
var resolvedRoles = _ref.resolvedRoles, | ||
metadata = _ref.metadata; | ||
if (timeDifference < 60) { | ||
distance = Math.round(timeDifference); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.second, distance) : timeDescriptors.second; | ||
} else if (timeDifference < 60 * 60) { | ||
// 1 hour | ||
distance = Math.round(timeDifference / 60); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.minute, distance) : timeDescriptors.minute; | ||
} else if (timeDifference < 60 * 60 * 24) { | ||
// 1 day | ||
distance = Math.round(timeDifference / (60 * 60)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.hour, distance) : timeDescriptors.hour; | ||
} else if (timeDifference < 60 * 60 * 24 * 7) { | ||
// 1 week | ||
distance = Math.round(timeDifference / (60 * 60 * 24)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.day, distance) : timeDescriptors.day; | ||
} else if (timeDifference < 60 * 60 * 24 * (365 / 12)) { | ||
// 1 month | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * 7)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.week, distance) : timeDescriptors.week; | ||
} else if (timeDifference < 60 * 60 * 24 * 30 * 12) { | ||
// # 1 year | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * (365 / 12))); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.month, distance) : timeDescriptors.month; | ||
} else { | ||
// More than 1 year | ||
distance = Math.round(timeDifference / (60 * 60 * 24 * 365)); | ||
ellapsedDescriptor = plural ? pluralize(timeDescriptors.year, distance) : timeDescriptors.year; | ||
} | ||
var customStylesheet = props.stylesheet, | ||
otherProps = _objectWithoutProperties(props, ["stylesheet"]); | ||
return _this.getTimestampSequence(distance, ellapsedDescriptor); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
var className = otherProps.className; | ||
_createClass(Timestamp, [{ | ||
key: "render", | ||
value: function render() { | ||
var _this2 = this; | ||
var styles = stylesheet({ stylesheet: customStylesheet }, resolvedRoles, metadata.colorSchemeId); | ||
return React.createElement( | ||
"div", | ||
{ className: emotion.cx(emotion.css(styles.timestamp), className) }, | ||
humanizeTimestamp() | ||
return React__default.createElement( | ||
ThemeContext.Consumer, | ||
null, | ||
function (_ref2) { | ||
var resolvedRoles = _ref2.resolvedRoles, | ||
metadata = _ref2.metadata; | ||
var _props = _this2.props, | ||
customStylesheet = _props.stylesheet, | ||
otherProps = _objectWithoutProperties(_props, ["stylesheet"]); | ||
var className = otherProps.className; | ||
var styles = stylesheet({ stylesheet: customStylesheet }, resolvedRoles, metadata.colorSchemeId); | ||
return React__default.createElement( | ||
"div", | ||
{ className: emotion.cx(emotion.css(styles.timestamp), className) }, | ||
_this2.humanizeTimestamp() | ||
); | ||
} | ||
); | ||
} | ||
); | ||
}; | ||
}]); | ||
Timestamp.displayName = "Timestamp"; | ||
return Timestamp; | ||
}(React.Component); | ||
@@ -185,3 +217,2 @@ Timestamp.propTypes = { | ||
}; | ||
Timestamp.defaultProps = { | ||
@@ -188,0 +219,0 @@ plural: true, |
@@ -0,1 +1,13 @@ | ||
# [@hig/timestamp-v1.3.2](https://github.com/Autodesk/hig/compare/@hig/timestamp@1.3.1...@hig/timestamp@1.3.2) (2022-01-12) | ||
### Bug Fixes | ||
* Forcing semantic release by editing readmes ([d39b61f](https://github.com/Autodesk/hig/commit/d39b61f)) | ||
### Reverts | ||
* "Revert "Revert "feat : Migrate all repository to React v17.0 """ ([bf78986](https://github.com/Autodesk/hig/commit/bf78986)) | ||
# [@hig/timestamp-v1.3.1](https://github.com/Autodesk/hig/compare/@hig/timestamp@1.3.0...@hig/timestamp@1.3.1) (2022-01-12) | ||
@@ -2,0 +14,0 @@ |
{ | ||
"name": "@hig/timestamp", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "HIG Timestamp", | ||
@@ -33,5 +33,5 @@ "author": "Autodesk Inc.", | ||
"peerDependencies": { | ||
"@hig/theme-context": "^3.0.2", | ||
"@hig/theme-context": "^3.0.3", | ||
"@hig/theme-data": "^2.22.0", | ||
"react": "^17.0.0" | ||
"react": "^15.4.1 || ^16.3.2" | ||
}, | ||
@@ -38,0 +38,0 @@ "scripts": { |
@@ -5,2 +5,3 @@ # Timestamp | ||
## Getting started | ||
@@ -7,0 +8,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29884
595
48