Class DateRange

  • All Implemented Interfaces:
    Serializable, org.apache.wicket.util.io.IClusterable

    public class DateRange
    extends Object
    implements org.apache.wicket.util.io.IClusterable
    Provides the value type to be used as model object for RangeDatePicker and RangeDatePickerTextField

    start and end dates are UTC based, the JSON array (toString()) is timezone agnostic
    Author:
    Sebastien Briquet - sebfz1
    See Also:
    Serialized Form
    • Constructor Detail

      • DateRange

        public DateRange​(Date start,
                         Date end)
        Constructor
        Parameters:
        start - the local start date
        end - the local end date
      • DateRange

        public DateRange​(long start,
                         long end)
        Constructor
        Parameters:
        start - the UTC start date
        end - the UTC end date
    • Method Detail

      • of

        public static DateRange of​(Date start,
                                   Date end)
        Creates a new DateRange, UTC time, starting at 0:00:00.000 and ending at 23:59:59.999
        Caution: supplied dates should be local to the system (ie: new Date()).
        Parameters:
        start - the local start date
        end - the local end date
        Returns:
        a new DateRange
      • of

        public static DateRange of​(long start,
                                   long end)
        Creates a new DateRange, starting at 0:00:00.000 and ending at 23:59:59.999
        Caution: supplied dates should be UTC.
        Parameters:
        start - the UTC start date
        end - the UTC end date
        Returns:
        a new DateRange
      • today

        public static DateRange today()
        Gets a default DateRange from today 0:00:00.000 to 23:59:59.999 (UTC).
        Returns:
        the DateRange
      • newDateFormat

        public static DateFormat newDateFormat()
        Gets a new UTC DateFormat using ISO8601 pattern, but timezone agnostic
        Returns:
        a new DateFormat
      • getStart

        public final Date getStart()
        Gets the start date
        Returns:
        the start date
      • setStart

        public void setStart​(Date date)
        Sets the start date.
        Parameters:
        date - the start date
      • setStart

        public void setStart​(long date)
        Sets the start date.
        Parameters:
        date - the start date
      • getEnd

        public Date getEnd()
        Gets the end date
        Returns:
        the end date
      • setEnd

        public void setEnd​(Date date)
        Sets the end date.
        Parameters:
        date - the end date
      • setEnd

        public void setEnd​(long date)
        Sets the end date.
        Parameters:
        date - the end date