ICAL. Period

This class represents the "period" value type, with various calculation and manipulation methods.

Constructor

new Period(aData)

Creates a new ICAL.Period instance. The passed data object cannot contain both and end date and a duration.

Parameters:
NameTypeDescription
aDataObject

An object with members of the period

Properties
NameTypeAttributesDescription
startICAL.Time<optional>

The start of the period

endICAL.Time<optional>

The end of the period

durationICAL.Duration<optional>

The duration of the period

Members

duration :ICAL.Duration

The duration of the period

end :ICAL.Time

The end of the period

(constant) icalclass :String

The class identifier.

Type:
  • String
Default Value
  • "icalperiod"

(constant) icaltype :String

The type name, to be used in the jCal object.

Type:
  • String
Default Value
  • "period"

start :ICAL.Time

The start of the period

Methods

clone() → {ICAL.Period}

Returns a clone of the duration object.

Returns:

The cloned object

Type: 
ICAL.Period

getDuration() → {ICAL.Duration}

Calculates the duration of the period, either directly or by subtracting start from end date.

Returns:

The calculated duration

Type: 
ICAL.Duration

getEnd() → {ICAL.Time}

Calculates the end date of the period, either directly or by adding duration to start date.

Returns:

The calculated end date

Type: 
ICAL.Time

toICALString() → {String}

The iCalendar string representation of this period.

Returns:
Type: 
String

toJSON() → {Object}

The jCal representation of this period type.

Returns:
Type: 
Object

toString() → {String}

The string representation of this period.

Returns:
Type: 
String

(static) fromData(aData) → {ICAL.Period}

Creates a new ICAL.Period instance from the given data object. The passed data object cannot contain both and end date and a duration.

Parameters:
NameTypeDescription
aDataObject

An object with members of the period

Properties
NameTypeAttributesDescription
startICAL.Time<optional>

The start of the period

endICAL.Time<optional>

The end of the period

durationICAL.Duration<optional>

The duration of the period

Returns:

The period instance

Type: 
ICAL.Period

(static) fromJSON(aData, aProp, aLenient) → {ICAL.Period}

Returns a new period instance from the given jCal data array. The first member is always the start date string, the second member is either a duration or end date string.

Parameters:
NameTypeDescription
aDataArray.<String, String>

The jCal data array

aPropICAL.Property

The property this jCal data is on

aLenientBoolean

If true, data value can be both date and date-time

Returns:

The period instance

Type: 
ICAL.Period

(static) fromString(str, prop) → {ICAL.Period}

Creates a new ICAL.Period instance from the passed string.

Parameters:
NameTypeDescription
strString

The string to parse

propICAL.Property

The property this period will be on

Returns:

The created period instance

Type: 
ICAL.Period