Module

dateRange

This file contains a series of functionalities that allow the manipulation of range dates.

View Source utils/dateRange.js, line 1

Methods

# inner contains(millis, dateRange) → {boolean}

Check if a date time in millis is in the DateRange specified

Parameters:
Name Type Description
millis number

Time from epoch.

dateRange Object
from number

Start timestamp value.

to number

End timestamp value.

View Source utils/dateRange.js, line 135

  • Check result.
boolean

# inner debug(dateRange) → {object}

Get a string object with dates in human readable format.

Parameters:
Name Type Description
dateRange Object
from number

Start timestamp value.

to number

End timestamp value.

View Source utils/dateRange.js, line 158

  • An object with from and to string values.
object

# inner fixRange(dateRange) → {Object}

Fix the date range when its values are no valid.

Parameters:
Name Type Description
dateRange Object
from number

Start timestamp value.

to number

End timestamp value.

View Source utils/dateRange.js, line 65

  • An object with from and to timestamp values.
Object

# inner fromNow(num, unit, forceStart) → {Object}

Generates a range of datestimes from a number of previous time units to the current date.

Parameters:
Name Type Default Description
num number 1

Number of units.

unit string day

Unit to use.

forceStart boolean | string true

Default true. Forces the start of the unit var. If you want to start in another unit you must specify the unit here.

View Source utils/dateRange.js, line 24

  • An object with from and to timestamp values.
Object

# inner fromToday(num, unit, forceStart) → {Object}

Generates a range of datetimes from a number of previous time units to the current start date.

Parameters:
Name Type Default Description
num number 1

Number of units

unit string day

Units to use.

forceStart Object | string true

Default true. Forces the start of the unit var. If you want to start in another unit you must specify the unit here.

View Source utils/dateRange.js, line 46

  • An object with from and to timestamp values.
Object

# inner getCurrentMonth() → {object}

Get a date range from the start of the current month to 23:59 yesterday.

View Source utils/dateRange.js, line 87

  • An object with from and to timestamp values.
object

# inner getLast30Days(offset) → {object}

Get the last 30 days range.

Parameters:
Name Type Default Description
offset number 0

The number of days before get the previous 30 days.

View Source utils/dateRange.js, line 113

  • An object with from and to timestamp values.
object

# inner getPrevMonth(offset) → {object}

Get the range of the previous month, starting from the beginning of the month at 00:00 until the month ends at 23:59.

Parameters:
Name Type Default Description
offset number 0

Number of previous months.

View Source utils/dateRange.js, line 97

  • An object with from and to timestamp values.
object

# inner getToday() → {object}

Get today date range, starting at 00:00 hours.

View Source utils/dateRange.js, line 79

  • An object with from and to timestamp values.
object

# inner size(dateRange, unit) → {number}

Get the number of units in a range.

Parameters:
Name Type Description
dateRange Object
from number

Start timestamp value.

to number

End timestamp value.

unit string

Unit to use.

View Source utils/dateRange.js, line 147

  • Number of units in range.
number