Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

js-getPastTime

get duration between now and past time

you can give parameters to the function as you wish... like:

var dateTime = new Date();
dateTime.setSeconds(dateTime.getSeconds()-20);
dateTime.setMinutes(dateTime.getMinutes()-40);
dateTime.setMonth(dateTime.getMonth()-1);

console.log(getPastTime(dateTime, {
	    year: true,
	    month: true,
	    day: true,
	    hour: true,
	    minute: true,
	    second: true
	  }));
	  
console.log(getPastTime(dateTime, [
	    true,
	    true,
	    true,
	    true,
	    true,
	    true
	  ]));
	  
console.log(getPastTime(dateTime, {
	    0: true,
	    1: true,
	    2: true,
	    3: true,
	    4: true,
	    5: true
	  }));
	  
console.log(getPastTime(dateTime, 
	    true,
	    true,
	    true,
	    true,
	    true,
	    true
	  ));

now just have persian langauge, soon will come with ability to define new langauges...

:)

About

get duration between now and past time

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages