
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
ranged-date
Advanced tools
Converts a given input to the number of milliseconds since the Unix epoch, provided that it can be parsed and recognized as seconds, milliseconds, or microseconds within a specified range in years from the current date.
Converts a given input to the number of milliseconds since the Unix epoch, provided that it can be parsed and recognized as seconds, milliseconds, or microseconds within a specified range in years from the current date.
Useful for parsing timestampted data from external APIs.
Node.JS version 6.0.0 or above.
npm i ranged-date
The following command will test the package for errors.
npm test
const rangedDate = require('ranged-date')
const time = ~~(Date.now() / 1000) // Test unixtime in seconds
const past = time - 31536000 // One year prior
const future = time + 31536000 // One year after
console.log(rangedDate(time)) // converted time in ms
console.log(rangedDate(time * 1000)) // converted time in ms
console.log(rangedDate(time * 1000 * 1000)) // converted time in ms
console.log(rangedDate(String(time))) // converted time in ms
console.log(rangedDate(past)) // false
console.log(rangedDate(past, 2)) // converted time in ms
console.log(rangedDate(future)) // false
console.log(rangedDate(future, null, 2)) // converted time in ms
number
| boolean
Returns: number
| boolean
- Converted ms or false if outside range.
Param | Type | Attributes | Default | Description |
---|---|---|---|---|
data | Date | number | string | Data to attempt to match. | ||
low | number | <optional> | 0.5 | Years before current date as lower bound. |
up | number | <optional> | 0.5 | Years after current date as upper bound. |
Please refer to the API docs for more detailed usage examples. Global functions are documented here.
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
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 0 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.