You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

react-timestamp

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-timestamp - npm Package Compare versions

Comparing version

to
3.1.0

19

lib/timestamp.js
'use strict';
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; }; })();
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; }; }();

@@ -18,4 +18,5 @@ var _react = require('react');

var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var Timestamp = (function (_React$Component) {
var Timestamp = function (_React$Component) {
_inherits(Timestamp, _React$Component);

@@ -26,3 +27,3 @@

return _possibleConstructorReturn(this, Object.getPrototypeOf(Timestamp).apply(this, arguments));
return _possibleConstructorReturn(this, (Timestamp.__proto__ || Object.getPrototypeOf(Timestamp)).apply(this, arguments));
}

@@ -116,3 +117,3 @@

case 'date':
return this._formatString("{0} {1} {2}", date.getDate(), MONTHS[date.getMonth()], date.getFullYear());
return (this.props.includeDay ? DAYS[date.getDay()] + ', ' : '') + this._formatString("{0} {1} {2}", date.getDate(), MONTHS[date.getMonth()], date.getFullYear());
case 'time':

@@ -122,3 +123,3 @@ return this._formatString("{0}:{1}{2}", hours, minutes, ampm);

default:
return this._formatString("{0} {1} {2}, {3}:{4}{5}", date.getDate(), MONTHS[date.getMonth()], date.getFullYear(), hours, minutes, ampm);
return (this.props.includeDay ? DAYS[date.getDay()] + ', ' : '') + this._formatString("{0} {1} {2}, {3}:{4}{5}", date.getDate(), MONTHS[date.getMonth()], date.getFullYear(), hours, minutes, ampm);
}

@@ -184,7 +185,8 @@ }

return Timestamp;
})(_react2.default.Component);
}(_react2.default.Component);
Timestamp.defaultProps = {
time: new Date(),
format: 'ago'
format: 'ago',
includeDay: false
};

@@ -195,5 +197,6 @@

format: _react2.default.PropTypes.string,
className: _react2.default.PropTypes.any
className: _react2.default.PropTypes.any,
includeDay: _react2.default.PropTypes.bool
};
module.exports = Timestamp;
{
"name": "react-timestamp",
"version": "3.0.4",
"version": "3.1.0",
"description": "A React component for displaying a datetime in the local timezone",

@@ -9,3 +9,3 @@ "main": "lib/timestamp.js",

"compile": "babel -d lib/ src/",
"prepublish": "npm test"
"prepublish": "npm run compile"
},

@@ -27,4 +27,4 @@ "repository": {

"homepage": "https://github.com/nathanhoad/react-timestamp#readme",
"dependencies": {
"react": "^0.14.3"
"peerDependencies": {
"react": "*"
},

@@ -31,0 +31,0 @@ "devDependencies": {

# Timestamp
![](https://codeship.com/projects/7a8c81a0-6225-0134-3d52-0627957cda96/status?branch=master)
A React component for displaying a datetime in the local timezone

@@ -13,3 +15,3 @@

```javascript
import Timestamp from 'react-timestamp';
const Timestamp = require('react-timestamp');
```

@@ -23,2 +25,3 @@

<Timestamp time="1450663457" />
<Timestamp time="1450663457" format='full' includeDay />
```

@@ -25,0 +28,0 @@