A simple JavaScript library for date manipulation
Import the code in your index.html
file:
<script src="/path/to/timerange.js"></script>
Initialize Timerange
:
var time = new Timerange();
These are the functions that Timerange
currently has:
- timeFrom(date,type)
- timeTo(date,type)
- display()
Find the amount of time from a certain date and/or time.
date
is a date object:new Date()
type
is a string of the 'format' you want the result in. Currently supports"days"
,"hours"
and"minutes"
Ex:time.timeFrom(new Date(), "minutes")
Find the amount of time until a certain date and/or time.
date
is a date object:new Date()
type
is a string of the 'format' you want the result in. Currently supports"days"
,"hours"
and"minutes"
Ex:time.timeTo(new Date(), "days")
Simply displays the result on screen. Ex: time.timeFrom(new Date()).display()