Represents a range of dates, corresponding to the Apache Solr type DateRangeField.

A date range can have one or two bounds, namely lower bound and upper bound, to represent an interval of time. Date range bounds are both inclusive. For example:

  • 2015 TO 2016-10 represents from the first day of 2015 to the last day of October 2016
  • 2015 represents during the course of the year 2015.
  • 2017 TO * represents any date greater or equals to the first day of the year 2017.

Note that this JavaScript representation of DateRangeField does not support Dates outside of the range supported by ECMAScript Date: –100,000,000 days to 100,000,000 days measured relative to midnight at the beginning of 01 January, 1970 UTC. Being -271821-04-20T00:00:00.000Z the minimum lower boundary and 275760-09-13T00:00:00.000Z the maximum higher boundary.

Static
This class is static

Members

DateRangeBound

lowerBound

Gets the lower bound of this range (inclusive).

DateRangeBound or null

upperBound

Gets the upper bound of this range (inclusive).

Constructor

new

DateRange

(DateRangeBound lowerBound, [DateRangeBound upperBound])

Creates a new instance of DateRange using a lower bound and an upper bound.

Consider using DateRange.fromString() to create instances more easily.

Parameters:
Name Type Description
lowerBound DateRangeBound

A value representing the range lower bound, composed by a Date and a precision. Use DateRangeBound.unbounded for an open lower bound.

upperBound optional DateRangeBound

A value representing the range upper bound, composed by a Date and a precision. Use DateRangeBound.unbounded for an open upper bound. When it’s not defined, the DateRange instance is considered as a single value range.

Methods

equals

(DateRange other)

Returns true if the value of this DateRange instance and other are the same.

Parameters:
Name Type Description
other DateRange
Returns:
Type Description
Boolean

DateRange.fromBuffer

(Buffer buffer)

Deserializes the buffer into a DateRange

Static
This function is static
Parameters:
Name Type Description
buffer Buffer
Returns:
Type Description
DateRange

DateRange.fromString

(String dateRangeString)

Returns the DateRange representation of a given string.

String representations of dates are always expressed in Coordinated Universal Time (UTC)

Static
This function is static
Parameters:
Name Type Description
dateRangeString String

toString

()

Returns the string representation of the instance.

Returns:
Type Description
String