Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "array/datespace/docs/types/index.d"

Index

Interfaces

Functions

Functions

Export assignment datespace

  • datespace(start: Date | number | string, stop: Date | number | string, options?: Options): Array<Date>
  • datespace(start: Date | number | string, stop: Date | number | string, length: number, options?: Options): Array<Date>
  • Generates an array of linearly spaced dates.

    throws

    must provide valid options

    Parameters

    • start: Date | number | string

      start time as either a Date object, Unix timestamp, JavaScript timestamp, or date string

    • stop: Date | number | string

      stop time as either a Date object, Unix timestamp, JavaScript timestamp, or date string

    • Optional options: Options

      function options

    Returns Array < Date >

    array of dates

    Example

    var stop = '2014-12-02T07:00:54.973Z';
    var start = new Date( stop ) - 60000;
    
    var arr = datespace( start, stop, 6 );
    // returns [...]

    Example

    // Equivalent of Math.ceil():
    var arr = datespace( 1417503655000, 1417503655001, 3, { 'round': 'ceil' } );
    // returns [...]
    
    // Equivalent of Math.round():
    var arr = datespace( 1417503655000, 1417503655001, 3, { 'round': 'round' } );
    // returns [...]
  • Generates an array of linearly spaced dates.

    throws

    length argument must a positive integer

    throws

    must provide valid options

    Parameters

    • start: Date | number | string

      start time as either a Date object, Unix timestamp, JavaScript timestamp, or date string

    • stop: Date | number | string

      stop time as either a Date object, Unix timestamp, JavaScript timestamp, or date string

    • length: number

      output array length (default: 100)

    • Optional options: Options

      function options

    Returns Array < Date >

    array of dates

    Example

    var stop = '2014-12-02T07:00:54.973Z';
    var start = new Date( stop ) - 60000;
    
    var arr = datespace( start, stop, 6 );
    // returns [...]

    Example

    // Equivalent of Math.ceil():
    var arr = datespace( 1417503655000, 1417503655001, 3, { 'round': 'ceil' } );
    // returns [...]
    
    // Equivalent of Math.round():
    var arr = datespace( 1417503655000, 1417503655001, 3, { 'round': 'round' } );
    // returns [...]