Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@scoir/date

Package Overview
Dependencies
Maintainers
36
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scoir/date - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4-0

dist/relative-time.js

1

dist/formatter.js

@@ -8,2 +8,3 @@ "use strict";

var _isCredibleDate = _interopRequireDefault(require("./is-credible-date"));
/** @deprecated use native or date-fns */
var DateFormatter = {

@@ -10,0 +11,0 @@ format: function format(date, _temp) {

6

dist/index.js

@@ -5,6 +5,8 @@ "use strict";

exports.__esModule = true;
exports.isCredibleDate = exports.formatter = void 0;
exports.useRelativeTime = exports.isCredibleDate = exports.formatter = void 0;
var _formatter = _interopRequireDefault(require("./formatter"));
exports.formatter = _formatter["default"];
var _isCredibleDate = _interopRequireDefault(require("./is-credible-date"));
exports.isCredibleDate = _isCredibleDate["default"];
exports.isCredibleDate = _isCredibleDate["default"];
var _relativeTime = _interopRequireDefault(require("./relative-time"));
exports.useRelativeTime = _relativeTime["default"];

@@ -8,4 +8,5 @@ "use strict";

var EMPTY_FORMAT = [undefined, null, '', '0001-01-01', '0001-01-01T00:00:00Z'];
/** @deprecated */
var _default = exports["default"] = function _default(input) {
return !(0, _includes["default"])(EMPTY_FORMAT, input);
};
import moment from 'moment-timezone'
import isCredibleDate from './is-credible-date'
/** @deprecated use native or date-fns */
const DateFormatter = {

@@ -6,0 +6,0 @@ format: (date, {defaultText, inputFormat, outputFormat = 'MMM DD, YYYY'} = {}) => {

export { default as formatter } from './formatter';
export { default as isCredibleDate } from './is-credible-date';
export {default as useRelativeTime } from './relative-time'
import { includes } from 'lodash'
const EMPTY_FORMAT = [undefined, null, '', '0001-01-01', '0001-01-01T00:00:00Z']
/** @deprecated */
export default input => {
return !includes(EMPTY_FORMAT, input)
}
{
"name": "@scoir/date",
"version": "2.0.3",
"version": "2.0.4-0",
"description": "",

@@ -16,8 +16,10 @@ "author": "@scoir",

"peerDependencies": {
"date-fns": "^2.28.0",
"lodash": "~4.17.11"
},
"dependencies": {
"date-fns": "^2.28.0",
"moment-timezone": "^0.5.34"
},
"gitHead": "b9c0faecaf06c1f08200b84e3f21a433801a2c24"
"gitHead": "93379ddec91dd661fea70d196cad1a548ef43558"
}
# Date
The date utility provides a formatter and isCredibleDate utility
## Usage - formatter
The date utility provides a useRelativeTime, formatter (deprecated), and isCredibleDate (deprecated) utility
## Usage - useRelativeTime
Use the useRelativeTime method with your date string to recieve a formatted string relative to now that updates every 60 seconds.
```
import { useRelativeTime } from '@scoir/date';
const ExampleComp = () => {
const formattedDate = useRelativeTime('2024-01-05T19:17:39.875Z')
render (
<Typography>{formattedDate}</Typography>
...
)
...
}
```
## Usage - formatter - deprecated
Use the format method with your date and an option configuration object.
The configuration can take defaultText, inputFormat, and an outputFormat.
```

@@ -24,4 +45,7 @@ import { formatter } from '@scoir/date';

```
## Usage - isCredibleDate
## Usage - isCredibleDate - deprecated
A method returning a boolean for a non-falsy and non-zero-date date input
```

@@ -28,0 +52,0 @@ import { isCredibleDate } from '@scoir/date';

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc