Constructor
new Duration(data)
Creates a new ICAL.Duration instance.
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Object | An object with members of the duration Properties
|
- Source
Members
days :Number
The days in this duration
- Number
- Default Value
- 0
- Source
hours :Number
The days in this duration
- Number
- Default Value
- 0
- Source
(constant) icalclass :String
The class identifier.
- String
- Default Value
- "icalduration"
- Source
(constant) icaltype :String
The type name, to be used in the jCal object.
- String
- Default Value
- "duration"
- Source
isNegative :Boolean
The seconds in this duration
- Boolean
- Default Value
- false
- Source
minutes :Number
The minutes in this duration
- Number
- Default Value
- 0
- Source
seconds :Number
The seconds in this duration
- Number
- Default Value
- 0
- Source
weeks :Number
The weeks in this duration
- Number
- Default Value
- 0
- Source
Methods
clone() → {ICAL.Duration}
Returns a clone of the duration object.
- Source
The cloned object
- Type:
- ICAL.
Duration
compare(aOther) → {Number}
Compares the duration instance with another one.
Name | Type | Description |
---|---|---|
aOther | ICAL. | The instance to compare with |
- Source
-1, 0 or 1 for less/equal/greater
- Type:
- Number
fromData(aData)
Sets up the current instance using members from the passed data object.
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aData | Object | An object with members of the duration Properties
|
- Source
fromSeconds(aSeconds) → {ICAL.Duration}
Reads the passed seconds value into this duration object. Afterwards, members like days and weeks will be set up accordingly.
Name | Type | Description |
---|---|---|
aSeconds | Number | The duration value in seconds |
- Source
Returns this instance
- Type:
- ICAL.
Duration
normalize()
Normalizes the duration instance. For example, a duration with a value of 61 seconds will be normalized to 1 minute and 1 second.
- Source
reset()
Resets the duration instance to the default values, i.e. PT0S
- Source
toICALString() → {String}
The iCalendar string representation of this duration.
- Source
- Type:
- String
toSeconds() → {Number}
The duration value expressed as a number of seconds.
- Source
The duration value in seconds
- Type:
- Number
toString() → {String}
The string representation of this duration.
- Source
- Type:
- String
(static) fromData(aData) → {ICAL.Duration}
Creates a new ICAL.Duration instance from the given data object.
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aData | Object | An object with members of the duration Properties
|
- Source
The createad duration instance
- Type:
- ICAL.
Duration
(static) fromSeconds(aSeconds) → {ICAL.Duration}
Returns a new ICAL.Duration instance from the passed seconds value.
Name | Type | Description |
---|---|---|
aSeconds | Number | The seconds to create the instance from |
- Source
The newly created duration instance
- Type:
- ICAL.
Duration
(static) fromString(aStr) → {ICAL.Duration}
Creates a new ICAL.Duration instance from the passed string.
Name | Type | Description |
---|---|---|
aStr | String | The string to parse |
- Source
The created duration instance
- Type:
- ICAL.
Duration
(static) isValueString(value) → {Boolean}
Checks if the given string is an iCalendar duration value.
Name | Type | Description |
---|---|---|
value | String | The raw ical value |
- Source
True, if the given value is of the duration ical type
- Type:
- Boolean