
Security News
/Company News
Securing the Financial Frontier: How Capital One Uses Socket for Open Source Security
Capital One is partnering with Socket to proactively secure its open source supply chain.
native-duration
Advanced tools
Calculate duration between two dates with zero dependencies (via Date object)
JavaScript / TypeScript library to Calculate duration between two dates with zero dependencies (via Date object).
import { durationToString } from 'native-duration'
const now = new Date()
console.log(
durationToString(
now,
new Date(+now + 10 ** 9)
)
)
// 1w 4d 13h 46min 40s
Of course, you can easily use it in any website, without Node.js, thanks to UNPKG.
<div id="mil-secs"></div>
<script type="module">
import { durationToString } from 'https://unpkg.com/native-duration'
const now = new Date()
document.getElementById('mil-secs').innerText = durationToString(
now,
new Date(+now + 10 ** 9)
)
</script>
npm i native-duration
Or, install directly from GitHub main branch.
npm i patarapolw/native-duration
FAQs
Calculate duration between two dates with zero dependencies (via Date object)
The npm package native-duration receives a total of 8 weekly downloads. As such, native-duration popularity was classified as not popular.
We found that native-duration 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.

Security News
/Company News
Capital One is partnering with Socket to proactively secure its open source supply chain.

Security News
Socket CTO Ahmad Nassri discusses how to keep AI agents from bypassing package blocks, limit credential access, and monitor their actions.

Security News
GPT-6 Astra tried to plant malicious code in simulated open source projects using fake GitHub accounts and deceptive PRs during an assigned CTF challenge.