Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
ranged-date
Advanced tools
Converts a given string, number, or Date object to the number of milliseconds since the Unix epoch, provided that it can be recognized as millisecond, second, or microsecond time within a specified range from the current date.
MIGRATION NOTICE:
Converts a given string, number, or Date object to the number of milliseconds since the Unix epoch, provided that it can be recognized as millisecond, second, or microsecond time within a specified range from the current date.
Milliseconds, seconds, or microseconds may be excluded as possibilities for range matching.
Useful for:
Node.JS version 6.0.0 or above.
npm i ranged-date
The following commands will test the package for errors.
cd /path/to/node_modules/ranged-date
npm test
Converts a given string, number, or Date object to the number of milliseconds since the Unix epoch, provided that it can be recognized as millisecond, second, or microsecond time within a specified range from the current date.
data
(Date | number | string) Data to attempt to recognize as valid date.yrBack
number Years before current date as lower bound.yrFwd
number Years after current date as upper bound.exclusions
Object Specifies interpretation exclusions, if any.
// All return current time in ms
rangedDate(new Date(), 1, 1)
rangedDate(Date.now(), 1, 1)
rangedDate(new Date().toString(), 1, 1)
rangedDate(String(Date.now()), 1, 1)
// All return false
rangedDate(Date.now() - 10000000, 0.0000001, 0.0000001)
rangedDate(Date.now(), 1, 1, {ms: true})
// All throw cert-is TypeAssertionErrors
rangedDate()
rangedDate(new Date())
rangedDate({})
rangedDate(328385)
// Throws cert-is RangeAssertionError
rangedDate(Date.now(), -1, -1)
Returns (number | boolean) Converted time in ms or false if outside range.
Thrown by cert-is in response to a type assertion error.
Type: Error
Thrown by cert-is in response to a range assertion error.
Type: Error
Versioning using SemVer. For available versions, see the tags on this repository.
This project is licensed under the ISC License - see the LICENSE.md file for details
<a name="2.1.0"></a> 2.1.0 (2019-06-15)
| Changes since 2.0.2 | Release Notes | README | | --- | --- | --- |
| Source Code (zip) | Source Code (tar.gz) | | --- | --- |
Features:
FAQs
Converts a given string, number, or Date object to the number of milliseconds since the Unix epoch, provided that it can be recognized as millisecond, second, or microsecond time within a specified range from the current date.
The npm package ranged-date receives a total of 13 weekly downloads. As such, ranged-date popularity was classified as not popular.
We found that ranged-date demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.