Module

dates

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

View Source utils/dates.js, line 1

Methods

# static genDates(to, num, unit, wholeDay) → {object}

Generate a date range following the params specifications.

Parameters:
Name Type Description
to number

End timestamp. Default now().

num number

Number of units to subtract from "to".

unit string

Unit.

wholeDay boolean

Specify whether "from" and "to" start at the beginning of the day.

View Source utils/dates.js, line 37

  • An object with from and to timestamp values.
object

# static genDates30DaysFromYesterday() → {object}

Get the date range of the previous 30 days.

View Source utils/dates.js, line 68

  • An object with from and to timestamp values.
object

# static genDatesToday() → {object}

Get a range date of the current date starting at 00:00 hours.

View Source utils/dates.js, line 52

  • An object with from and to timestamp values.
object

# static genDatesYesterday() → {object}

Get yesterday's date range.

View Source utils/dates.js, line 60

  • An object with from and to timestamp values.
object

# static genRangeDates(start, end, jump, format) → {Array.<number>}

Generate a range of dates between the two passed dates.

Parameters:
Name Type Description
start number

The start timestamp.

end number

The end timestamp.

jump string

The jump for every iter: 'days', 'weeks', 'months'...

format string

The format for the result dates.

View Source utils/dates.js, line 17

  • Array of datetimes range.
Array.<number>