Home Identifier Source
import Index from '@esnet/pond/src/index.js'
public class | source

Index

An index that represents as a string a range of time. That range may either be in UTC or local time. UTC is the default.

The actual derived timerange can be found using asRange(). This will return a TimeRange instance.

The original string representation can be found with toString(). A nice version for date based indexes (e.g. 2015-03) can be generated with toNiceString(format) (e.g. March, 2015).

Constructor Summary

Public Constructor
public

constructor(s: *, utc: *)

Method Summary

Public Methods
public

Alias for toString()

public

Returns the Index as a TimeRange

public

begin(): Date

Returns the start date of the Index

public

end(): Date

Returns the end date of the Index

public

Returns the Index as JSON, which will just be its string

public

toNiceString(format: *): string

for the calendar range style Indexes, this lets you return

public

Simply returns the Index as its string

Public Constructors

public constructor(s: *, utc: *) source

Params:

NameTypeAttributeDescription
s *
utc *

Public Methods

public asString(): string source

Alias for toString()

Return:

string

String representation of the Index

public asTimerange(): TimeRange source

Returns the Index as a TimeRange

Return:

TimeRange

TimeRange representation of the Index

public begin(): Date source

Returns the start date of the Index

Return:

Date

Begin date

public end(): Date source

Returns the end date of the Index

Return:

Date

End date

public toJSON(): Object source

Returns the Index as JSON, which will just be its string representation

Return:

Object

JSON representation of the Index

public toNiceString(format: *): string source

for the calendar range style Indexes, this lets you return that calendar range as a human readable format, e.g. "June, 2014". The format specified is a Moment.format.

Params:

NameTypeAttributeDescription
format *

Return:

string

String representation of the Index

public toString(): string source

Simply returns the Index as its string

Return:

string

String representation of the Index