
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Simplistic library for dealing with Durations
The strings that this module outputs could be represented with the following ABNF, which is a subset of that found in RFC3339 for Durations:
dur-second = 1*DIGIT "S"
dur-minute = 1*DIGIT "M" [dur-second]
dur-hour = 1*DIGIT "H" [dur-minute]
dur-time = "T" (dur-hour / dur-minute / dur-second)
duration = "P" dur-time
Specifically, this module does not handle Years, Months, Days, or Weeks. It also doesn't accept fractional seconds (milli / nano seconds).
PT20S // 0 Hours, 0 Minutes, 20 Seconds
PT10M // 0 Hours, 10 Minutes, 0 Seconds
PT1H // 1 Hours, 0 Minutes, 0 Seconds
PT1H20S // 1 Hours, 0 Minutes, 20 Seconds
PT1H10M // 1 Hours, 10 Minutes, 0 Seconds
PT1H10M20S // 1 Hours, 10 Minutes, 20 Seconds
PT26H10M20S // 26 Hours, 10 Minutes, 20 Seconds
When a method accepts or returns an object, it'll use the following structure:
{
hours: Integer,
minutes: Integer,
seconds: Integer
}
Takes an integer and creates a Duration Object. See the source code for details, but seconds are used first, then minutes, then hours.
For example, fromSeconds(60)
would return { hours: 0, minutes: 1, seconds: 0 }
Parses a given String using the format specified above. Returns an Duration Object
.
Accepts a Duration Object
or a integer
value representing the duration in seconds. When an integer
argument is given, the value is first passed to fromSeconds
, in order to get it's Duration Object
representation.
Returns a String matching the ABNF listed above. In the case of the duration having a total length of 0 seconds, PT0S
is returned, such that you still can parse it at a later date.
FAQs
Small library for dealing with Durations
The npm package durational receives a total of 110 weekly downloads. As such, durational popularity was classified as not popular.
We found that durational 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
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.