This file contains a series of functionalities that allow the manipulation of range dates.
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. |
- 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. |
- 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. |
- 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. |
- 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. |
- 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.
- 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. |
- 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. |
- An object with from and to timestamp values.
object
# inner getToday() → {object}
Get today date range, starting at 00:00 hours.
- 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. |
- Number of units in range.
number