Skip to content

JavaScript translation of the Python/Django function timesince

Notifications You must be signed in to change notification settings

chmielu/timesince

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

A JavaScript translation of the timesince function from Django/Python.

timesince() converts Date objects to a human readable format which is a delta from
the current time.  Here is an example: '2 months, 3 days'.

Put this snippet in an HTML page for an example of use:

<script src="timesince.js"></script>
<script>
  var now = new Date();
  var d = new Date(now.getTime() - 3 * 60 * 60 * 1000);
  alert(d.timesince());
</script>

About

JavaScript translation of the Python/Django function timesince

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published