A collection of functions for working with dates
npm install lkt-date-toolsChecks if a given var is a Date obj
| Arg | Type | Default | Description |
|-------------|------|---------|----------------|
| target | any | | Var to check |
#### Usage
``js
import {isDate} from "lkt-date-tools";
isDate(new Date()); // Returns true
isDate('date'); // Returns false
`
Converts a ISO formatted date to a Date object
| Arg | Type | Default | Description |
|--------|--------|---------|-------------------|
| str | string | | String to convert |
#### Usage
`js
import {isoToDate} from "lkt-date-tools";
const date = isoToDate('2020-04-23T00:00:00');
`
Converts a 'Y-m-d' formatted date to a Date object
| Arg | Type | Default | Description |
|--------|--------|---------|-------------------|
| str | string | | String to convert |
#### Usage
`js
import {ymdToDate} from "lkt-date-tools";
const date = ymdToDate('2020-04-23');
`
Returns current time (in seconds)
#### Usage
`js
import {time} from "lkt-date-tools";
const stamp = time();
`
Returns current time (in milliseconds)
#### Usage
`js
import {timeInMilliseconds} from "lkt-date-tools";
const stamp = timeInMilliseconds();
`
Returns current timestamp in milliseconds
#### Usage
`js
import {getStampInMilliseconds} from "lkt-date-tools";
const stamp = getStampInMilliseconds();
`
Returns the seconds in one year
#### Usage
`js
import {getOneYearInSeconds} from "lkt-date-tools";
const stamp = getOneYearInSeconds();
`
Converts from seconds to milliseconds
| Arg | Type | Default | Description |
|---------|--------|---------|--------------------|
| seconds | number | | Seconds to convert |
#### Usage
`js
import {secondsToMilliseconds} from "lkt-date-tools";
const stamp = secondsToMilliseconds();
`
Converts a Date object to an unix timestamp
| Arg | Type | Default | Description |
|------|------|---------|-----------------|
| date | Date | | Date to convert |
#### Usage
`js
import {dateToTimestamp} from "lkt-date-tools";
const stamp = dateToTimestamp(new Date());
``