![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
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.
A module for getting the elapsed time between two dates in various representation.
npm install elapsed
A module for getting the elapsed time between two dates in various representation.
var Elapsed = require('elapsed');
var elapsedTime = new Elapsed(new Date(2013, 05, 2), new Date(2013, 05, 25));
console.log(elapsedTime.minutes.num); // 33120
console.log(elapsedTime.hours.text); // "552 hours"
console.log(elapsedTime.optimal); // "3 weeks"
var elapsedTime = new Elapsed(from, to, i10n);
The from
(required) and to
(optional, default: now) must be Date
objects. i10n
(optional: default: english) must be a plain object.
num
property is the time in Number, text
is the time in String.num
property is the time in Number, text
is the time in String.num
property is the time in Number, text
is the time in String.num
property is the time in Number, text
is the time in String.num
property is the time in Number, text
is the time in String.num
property is the time in Number, text
is the time in String.num
property is the time in Number, text
is the time in String.num
property is the time in Number, text
is the time in String.to
date. to
is optional it defaults to now.If you want to localize the elapsed time, you can provide an object holding the translations by passing it into the constructor as a third argument.
var i10n = {…};
var elapsedTime = new Elapsed(from, to, i10n);
Take a look at the english version, to get an impression of how the object should look like:
var i10n = {
milliSeconds: ['millisecond', 's'],
seconds: ['second', 's'],
minutes: ['minute', 's'],
hours: ['hour', 's'],
days: ['day', 's'],
weeks: ['week', 's'],
months: ['month', 's'],
years: ['year', 's']
};
Each property holds an array containing the singular and the plural-suffix.
If you don't need to specify the to
-parameter, you can pass in the localization as second parameter:
var i10n = {…};
var elapsedTime = new Elapsed(from, i10n);
FAQs
A module for getting the elapsed time between two dates in various representation.
We found that elapsed 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
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.