
Product
Socket Now Protects the Chrome Extension Ecosystem
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
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 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.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.