com.isomorphic.util.date

## Class RelativeDate

- java.lang.Object
- - com.isomorphic.util.date.RelativeDate

- All Implemented Interfaces:
    java.lang.Comparable

      public class RelativeDate
      extends java.lang.Object
      implements java.lang.Comparable

  Representation of a relative date. Given a string or `RelativeDateShortcut` an absolute date can be retrieved based on a fixed point in time as the point of relevance.

  A relative date can also contain a `RelativeDateRangePosition` which is only used if the relative date string is a `RelativeDateShortcut`. For instance, if `RelativeDateShortcut.TODAY` is used we don't know if that means the start or the end of today, use the range position to specify which is true.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.GregorianCalendar` | `getAbsoluteDate(boolean isLogicalDate)` Gets the absolute date for this relative date with the current date and time as the relevance point.
    `java.util.GregorianCalendar` | `getAbsoluteDate(java.util.Date baseDate, boolean isLogicalDate)` Gets the absolute date for this relative date with a base date and time as the relevance point, based on the server timezone
    `java.util.GregorianCalendar` | `getAbsoluteDate(java.util.Date baseDate, boolean isLogicalDate, java.util.TimeZone tz)` Gets the absolute date for this relative date with a base date and time as the relevance point.
    `java.lang.String` | `getDirection()` Returns the direction sign for this relative date.
    `RelativeDate` | `getQualifier()` Returns the qualifier for this relative date, the qualifier is another relative date.
    `RelativeDateRangePosition` | `getRangePosition()` Returns the `RelativeDateRangePosition` for this relative date.
    `int` | `getValue()` Returns the value of this relative date, the value is the number of units.
    `void` | `setRangePosition(RelativeDateRangePosition rangePosition)` Sets the `RelativeDateRangePosition` for this relative date.

- - ### Method Detail

    - #### getAbsoluteDate

          public java.util.GregorianCalendar getAbsoluteDate(boolean isLogicalDate)

      Gets the absolute date for this relative date with the current date and time as the relevance point.
      Parameters:
        `isLogicalDate` - false if this date should include the time.
      Returns:
        a gregorian calendar.

    - #### getAbsoluteDate

          public java.util.GregorianCalendar getAbsoluteDate(java.util.Date baseDate,
                                                             boolean isLogicalDate)

      Gets the absolute date for this relative date with a base date and time as the relevance point, based on the server timezone
      Parameters:
        `baseDate` - the relevance point to get the absolute date for.
        `isLogicalDate` - false if this date should include the time.
      Returns:
        a gregorian calendar.

    - #### getAbsoluteDate

          public java.util.GregorianCalendar getAbsoluteDate(java.util.Date baseDate,
                                                             boolean isLogicalDate,
                                                             java.util.TimeZone tz)

      Gets the absolute date for this relative date with a base date and time as the relevance point.
      Parameters:
        `baseDate` - the relevance point to get the absolute date for.
        `isLogicalDate` - false if this date should include the time.
        `tz` - the base TimeZone of the returned GregorianCalendar. If null, uses server timezone
      Returns:
        a gregorian calendar.

    - #### getRangePosition

          public RelativeDateRangePosition getRangePosition()

      Returns the `RelativeDateRangePosition` for this relative date.
      Returns:
        the range position.

    - #### setRangePosition

          public void setRangePosition(RelativeDateRangePosition rangePosition)

      Sets the `RelativeDateRangePosition` for this relative date.
      Parameters:
        `rangePosition` -

    - #### getDirection

          public java.lang.String getDirection()

      Returns the direction sign for this relative date.
      Returns:
        either '+' or '-'.

    - #### getQualifier

          public RelativeDate getQualifier()

      Returns the qualifier for this relative date, the qualifier is another relative date.
      Returns:
        the qualifier.

    - #### getValue

          public int getValue()

      Returns the value of this relative date, the value is the number of units.
      Returns:
        the value.