Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
humanize-ms
Advanced tools
The humanize-ms npm package is designed to convert various time formats into milliseconds. It is particularly useful for applications that need to handle and manipulate time intervals in a human-readable format and then convert them to milliseconds for processing or scheduling tasks.
Convert human-readable strings to milliseconds
This feature allows the conversion of a human-readable string like '2 days' into its equivalent in milliseconds. It is useful for setting timeouts, intervals, or calculating durations in applications.
const humanize = require('humanize-ms');
console.log(humanize('2 days')); // 172800000
Support for various time units
The package supports various time units such as hours, minutes, and seconds, allowing for flexible conversions depending on the needs of the application.
const humanize = require('humanize-ms');
console.log(humanize('1 hour')); // 3600000
console.log(humanize('30 seconds')); // 30000
Similar to humanize-ms, the 'ms' package provides utilities for converting various time formats into milliseconds and vice versa. It also allows for string representations like '1h' which humanize-ms supports. The 'ms' package is widely used and offers both parsing and formatting capabilities, making it slightly more versatile compared to humanize-ms.
The 'parse-duration' npm package is another alternative that converts human-readable duration strings into milliseconds. Unlike humanize-ms, parse-duration can handle a broader range of time formats and units, providing more flexibility for parsing complex duration expressions.
transform humanize time to ms
npm install humanize-ms
import { ms } from 'humanize-ms';
ms('1s') // 1000
ms(1000) // 1000
Made with contributors-img.
2.0.0 (2024-12-12)
https://github.com/eggjs/egg/issues/5257
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->New Features
Introduced a new function ms
for converting human-readable time
formats into milliseconds.
Added multiple GitHub Actions workflows for CI, testing, and publishing automation.
Bug Fixes
Removed outdated configuration files that could lead to linting errors or CI issues.
Documentation
Updated README.md
with new CI/CD references, installation
instructions, and contributor acknowledgments.
Chores
Updated package.json
with new dependencies and scripts for linting
and testing.
FAQs
transform humanize time to ms
The npm package humanize-ms receives a total of 0 weekly downloads. As such, humanize-ms popularity was classified as not popular.
We found that humanize-ms demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.