@scoir/date
Advanced tools
Comparing version 2.0.3 to 2.0.4-0
@@ -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) { |
@@ -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'; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
17230
20
379
63
0
4
2
+ Addeddate-fns@^2.28.0
+ Added@babel/runtime@7.26.0(transitive)
+ Addeddate-fns@2.30.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)