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

TimeRange

Static Method Summary

Static Public Methods
public static

lastDay(): *

public static
public static
public static

Constructor Summary

Public Constructor
public

constructor(arg1: *, arg2: *)

Builds a new TimeRange which may be of several different formats:

Method Summary

Public Methods
public

begin(): Date

Returns the begin time of the TimeRange.

public

contains(other: *): boolean

Returns true if other is completely inside this.

public

disjoint(other: *): *

Returns true if the passed in other Range in no way

public

duration(): *

public

end(): Date

Returns the end time of the TimeRange.

public

equals(other: *): *

Returns if the two TimeRanges can be considered equal,

public

extents(other: *): *

Returns a new Timerange which covers the extents of this and

public

Returns a human friendly version of the TimeRange, e.g.

public
public

intersection(other: *): *

Returns a new TimeRange which represents the intersection

public

overlaps(other: *): boolean

Returns true if the passed in other TimeRange overlaps this time Range.

public

range(): *

Returns the internal range, which is an Immutable List containing

public

Returns a human friendly version of the TimeRange, e.g.

public

setBegin(t: *): *

Sets a new begin time on the TimeRange.

public

setEnd(t: *): *

Sets a new end time on the TimeRange.

public

toJSON(): number[]

Returns the TimeRange as JSON, which will be a Javascript array

public

Returns the TimeRange as a string expressed in local time

public

Returns the TimeRange as a string, useful for serialization.

public

Returns the TimeRange as a string expressed in UTC time

public

within(other: *): *

Returns true if this TimeRange is completely within the supplied

Static Public Methods

public static lastDay(): * source

Return:

*

public static lastNinetyDays(): * source

Return:

*

public static lastSevenDays(): * source

Return:

*

public static lastThirtyDays(): * source

Return:

*

Public Constructors

public constructor(arg1: *, arg2: *) source

Builds a new TimeRange which may be of several different formats:

  • Another TimeRange (copy constructor)
  • An Immutable.List containing two Dates.
  • A Javascript array containing two Date or ms timestamps
  • Two arguments, begin and end, each of which may be a Data, a Moment, or a ms timestamp.

Params:

NameTypeAttributeDescription
arg1 *
arg2 *

Public Methods

public begin(): Date source

Returns the begin time of the TimeRange.

Return:

Date

Begin time

public contains(other: *): boolean source

Returns true if other is completely inside this.

Params:

NameTypeAttributeDescription
other *

Return:

boolean

public disjoint(other: *): * source

Returns true if the passed in other Range in no way overlaps this time Range.

Params:

NameTypeAttributeDescription
other *

Return:

*

public duration(): * source

Return:

*

public end(): Date source

Returns the end time of the TimeRange.

Return:

Date

End time

public equals(other: *): * source

Returns if the two TimeRanges can be considered equal, in that they have the same times.

Params:

NameTypeAttributeDescription
other *

Return:

*

public extents(other: *): * source

Returns a new Timerange which covers the extents of this and other combined.

Params:

NameTypeAttributeDescription
other *

Return:

*

public humanize(): string source

Returns a human friendly version of the TimeRange, e.g. "Aug 1, 2014 05:19:59 am to Aug 1, 2014 07:41:06 am"

Return:

string

Human friendly string representation of the TimeRange

public humanizeDuration(): * source

Return:

*

public intersection(other: *): * source

Returns a new TimeRange which represents the intersection (overlapping) part of this and other.

Params:

NameTypeAttributeDescription
other *

Return:

*

public overlaps(other: *): boolean source

Returns true if the passed in other TimeRange overlaps this time Range.

Params:

NameTypeAttributeDescription
other *

Return:

boolean

public range(): * source

Returns the internal range, which is an Immutable List containing begin and end keys

Return:

*

public relativeString(): string source

Returns a human friendly version of the TimeRange, e.g. e.g. "a few seconds ago to a month ago"

Return:

string

Human friendly string representation of the TimeRange

public setBegin(t: *): * source

Sets a new begin time on the TimeRange. The result will be a new TimeRange.

Params:

NameTypeAttributeDescription
t *

Return:

*

public setEnd(t: *): * source

Sets a new end time on the TimeRange. The result will be a new TimeRange.

Params:

NameTypeAttributeDescription
t *

Return:

*

public toJSON(): number[] source

Returns the TimeRange as JSON, which will be a Javascript array of two ms timestamps.

Return:

number[]

JSON representation of the TimeRange

public toLocalString(): string source

Returns the TimeRange as a string expressed in local time

Return:

string

String representation of the TimeRange

public toString(): string source

Returns the TimeRange as a string, useful for serialization.

Return:

string

String representation of the TimeRange

public toUTCString(): string source

Returns the TimeRange as a string expressed in UTC time

Return:

string

String representation of the TimeRange

public within(other: *): * source

Returns true if this TimeRange is completely within the supplied other TimeRange.

Params:

NameTypeAttributeDescription
other *

Return:

*