Packagecom.keepcore.calendar.model
Classpublic class DateRange
InheritanceDateRange Inheritance Object

DateRange class is used to define period of time and helps to compute times.



Public Properties
 PropertyDefined By
  duration : Number
Return the duration between begin and end of the date range (in ms).
DateRange
  endDate : Date
Date range end date.
DateRange
  startDate : Date
Date range start date.
DateRange
  valid : Boolean
[read-only] Return if the date range is valid (ie: start date lower than end date)
DateRange
Public Methods
 MethodDefined By
  
DateRange(startDate:Date = null, endDate:Date = null)
Contructor.
DateRange
  
[static] Add two ranges.
DateRange
  
Returns a clone of the date range.
DateRange
  
contains(date:Date):Boolean
Return if the given date is contained in the current DateRange we just compare the date (and not the time)because this function helps to know if an item is contained in a calendar day cell
DateRange
  
containsRange(range:DateRange):Boolean
Return if the given range is contained in the current DateRange.
DateRange
  
defineDayRange(date:Date):void
Set date range to the day of the given date
DateRange
  
defineMonthRange(date:Date):void
Set date range to the month of the given date
DateRange
  
defineWeekRange(date:Date):void
Set date range to the current week of the given date.
DateRange
  
defineYearRange(date:Date):void
Set date range to the year of given date.
DateRange
  
equals(dateRange:DateRange):Boolean
Check if date range equals the given date range by comparing startDate & endDate.
DateRange
  
DateRange
  
Return the duration in days of the date range Important note: full day event are described with a end date set at day+1 but with 00:00 as hour/minutes
DateRange
  
getDurationInHours(splitToDayEnd:Boolean = false, splitToDayStart:Boolean = false):Number
Return the duration between begin and end of the date range (in hours).
DateRange
  
Returns a clone of: the startDate if not null else the endDate if not null or the current date
DateRange
  
Returns the data range representing the intersection between current range and given one.
DateRange
  
mergeRanges(ranges:ArrayCollection):ArrayCollection
[static] Merge an array of ranges: ranges with intersections are merged leading to a new array of ranges.
DateRange
  
moveTo(newStart:Date):void
Move the current range to the new start date (move also the end date).
DateRange
  
Return the duration of the date range in months.
DateRange
  
Return the duration of the date range in weeks.
DateRange
  
toString():String
Returns the string representation of the date range, i.e: 30/01/2010 18:45 -- 27/02/2010 00:10
DateRange
Property Detail
durationproperty
duration:Number

Return the duration between begin and end of the date range (in ms). If set, endDate is modified to startDate + duration.


Implementation
    public function get duration():Number
    public function set duration(value:Number):void
endDateproperty 
endDate:Date

Date range end date.


Implementation
    public function get endDate():Date
    public function set endDate(value:Date):void
startDateproperty 
startDate:Date

Date range start date.


Implementation
    public function get startDate():Date
    public function set startDate(value:Date):void
validproperty 
valid:Boolean  [read-only]

Return if the date range is valid (ie: start date lower than end date)


Implementation
    public function get valid():Boolean
Constructor Detail
DateRange()Constructor
public function DateRange(startDate:Date = null, endDate:Date = null)

Contructor. Initialize startDate & endDate. Note: dates are cloned to avoid keeping references on given dates and changes them upon date range modifications.

Parameters
startDate:Date (default = null)
 
endDate:Date (default = null)
Method Detail
addRanges()method
public static function addRanges(range1:DateRange, range2:DateRange):DateRange

Add two ranges.

Parameters

range1:DateRange — first range
 
range2:DateRange — second range

Returns
DateRange — date range starting at the prior start date and ending at the oldest end date.
clone()method 
public function clone():DateRange

Returns a clone of the date range.

Returns
DateRange — date range
contains()method 
public function contains(date:Date):Boolean

Return if the given date is contained in the current DateRange we just compare the date (and not the time)because this function helps to know if an item is contained in a calendar day cell

Parameters

date:Date

Returns
Boolean
containsRange()method 
public function containsRange(range:DateRange):Boolean

Return if the given range is contained in the current DateRange.

Parameters

range:DateRange — range to check

Returns
Boolean — true if range is contained
defineDayRange()method 
public function defineDayRange(date:Date):void

Set date range to the day of the given date

Parameters

date:Date — on which the range will be based

defineMonthRange()method 
public function defineMonthRange(date:Date):void

Set date range to the month of the given date

Parameters

date:Date — on which the range will be based

defineWeekRange()method 
public function defineWeekRange(date:Date):void

Set date range to the current week of the given date.

Parameters

date:Date — on which the range will be based

defineYearRange()method 
public function defineYearRange(date:Date):void

Set date range to the year of given date.

Parameters

date:Date — on which the range will be based

equals()method 
public function equals(dateRange:DateRange):Boolean

Check if date range equals the given date range by comparing startDate & endDate.

Parameters

dateRange:DateRange — to compare

Returns
Boolean — true if date ranges are the sames
getConcurrencyIntersection()method 
public function getConcurrencyIntersection(dateRange:DateRange):DateRange

Parameters

dateRange:DateRange

Returns
DateRange
getDurationInDays()method 
public function getDurationInDays():int

Return the duration in days of the date range Important note: full day event are described with a end date set at day+1 but with 00:00 as hour/minutes

Returns
int
getDurationInHours()method 
public function getDurationInHours(splitToDayEnd:Boolean = false, splitToDayStart:Boolean = false):Number

Return the duration between begin and end of the date range (in hours).

Parameters

splitToDayEnd:Boolean (default = false) — indicates if endDate day hours are counted
 
splitToDayStart:Boolean (default = false) — indicates if only endDate day hours are counted

Returns
Number
getPertinentDate()method 
public function getPertinentDate():Date

Returns a clone of:

  • the startDate if not null
  • else the endDate if not null
  • or the current date
  • Returns
    Date
    intersect()method 
    public function intersect(range:DateRange):DateRange

    Returns the data range representing the intersection between current range and given one.

    Parameters

    range:DateRange

    Returns
    DateRange — a DateRange result of the intersection. Note: valid property can be tested to know if there is some intersection. valid will return false if there is no intersection (start>end).
    mergeRanges()method 
    public static function mergeRanges(ranges:ArrayCollection):ArrayCollection

    Merge an array of ranges: ranges with intersections are merged leading to a new array of ranges.

    Parameters

    ranges:ArrayCollection — array of ranges (DateRange objects) to merge

    Returns
    ArrayCollection — merged array
    moveTo()method 
    public function moveTo(newStart:Date):void

    Move the current range to the new start date (move also the end date).

    Parameters

    newStart:Date

    rangeMonthSpan()method 
    public function rangeMonthSpan():int

    Return the duration of the date range in months. This function helps to know how many renderer is necessary to draw the item in year view

    Returns
    int
    rangeWeekSpan()method 
    public function rangeWeekSpan():int

    Return the duration of the date range in weeks. This function helps to know how many row is necessary to draw the item.

    Returns
    int
    toString()method 
    public function toString():String

    Returns the string representation of the date range, i.e: 30/01/2010 18:45 -- 27/02/2010 00:10

    Returns
    String — a string