Skip to content

Repository files navigation

date-range

DateRange component

Installation

$ component install component/date-range

Example

varDateRange=require('./');varnow=newDate;varfuture=newDate(Date.now()+60000*5);varrange=newDateRange(now,future);

API

DateRange()

Initialize a new DateRange from one date to another. If one date is larger than the other they are normalized so that .from() is always the smallest date.

DateRange#from([date]:Date)

Set / get from date.

DateRange#to([date]:Date)

Set / get to date.

DateRange#diff()

Return diff in milliseconds

DateRange#toJSON()

Return JSON representation.

DateRange#equals(other:DateRange)

Check if this range is identical to other.

DateRange#toString()

Return string representation.

License

MIT

About

object representing / normalizing date ranges

Resources

Stars

4 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages