Class Duration

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

Alias

ICAL.Duration

Hierarchy

  • Duration

Constructors

  • Creates a new ICAL.Duration instance.

    Parameters

    • Optional data: DurationData

      An object with members of the duration

    Returns Duration

Properties

days: number = 0

The days in this duration

hours: number = 0

The days in this duration

icalclass: string = 'icalduration'

The class identifier.

icaltype: string = 'duration'

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

isNegative: boolean = false

The seconds in this duration

minutes: number = 0

The minutes in this duration

seconds: number = 0

The seconds in this duration

weeks: number = 0

The weeks in this duration

wrappedJSObject: Duration

Methods

  • Compares the duration instance with another one.

    Parameters

    • aOther: Duration

      The instance to compare with

    Returns number

    -1, 0 or 1 for less/equal/greater

  • Sets up the current instance using members from the passed data object.

    Parameters

    • Optional aData: DurationData

      An object with members of the duration

    Returns void

  • Reads the passed seconds value into this duration object. Afterwards, members like days and weeks will be set up accordingly.

    Parameters

    • aSeconds: number

      The duration value in seconds

    Returns Duration

    Returns this instance

  • Normalizes the duration instance. For example, a duration with a value of 61 seconds will be normalized to 1 minute and 1 second.

    Returns void

  • Resets the duration instance to the default values, i.e. PT0S

    Returns void

  • The iCalendar string representation of this duration.

    Returns string

  • The duration value expressed as a number of seconds.

    Returns number

    The duration value in seconds

  • The string representation of this duration.

    Returns string

  • Creates a new ICAL.Duration instance from the given data object.

    Parameters

    • aData: DurationData

      An object with members of the duration

    Returns Duration

    The created duration instance

  • Returns a new ICAL.Duration instance from the passed seconds value.

    Parameters

    • aSeconds: number

      The seconds to create the instance from

    Returns Duration

    The newly created duration instance

  • Creates a new Duration instance from the passed string.

    Parameters

    • aStr: string

      The string to parse

    Returns Duration

    The created duration instance

  • Checks if the given string is an iCalendar duration value.

    Parameters

    • string: string

      The raw ical value

    Returns boolean

    True, if the given value is of the duration ical type

Generated using TypeDoc