
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
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 Duration from "native-duration";
const now = new Date();
console.log(Duration.of(10 ** 9).toString());
// 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 Duration from "https://unpkg.com/native-duration";
const now = new Date();
document.getElementById("mil-secs").innerText = Duration.of(
10 ** 9
).toString();
</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 10 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.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.