Constructor
new VCardTime(data, zone, icaltype)
Creates a new ICAL.VCardTime instance.
| Name | Type | Description | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
data | Object | The data for the time instance Properties
| ||||||||||||||||||||||||||||
zone | ICAL. | The timezone to use | ||||||||||||||||||||||||||||
icaltype | String | The type for this date/time object |
- Source
Extends
Members
(constant) DEFAULT_WEEK_START
The default weekday for the WKST part.
- Overrides
- Default Value
- ICAL.Time.MONDAY
day :Number
The day of this date.
- Number
- Overrides
daysInYearPassedMonth :Array.<Array.<Number>>
The days that have passed in the year after a given month. The array has two members, one being an array of passed days for non-leap years, the other analog for leap years.
- Array.<Array.<Number>>
- Overrides
var isLeapYear = ICAL.Time.isLeapYear(year);
var passedDays = ICAL.Time.daysInYearPassedMonth[isLeapYear][month];(constant) epochTime :ICAL.Time
January 1st, 1970 as an ICAL.Time.
- Overrides
fromData
Creates a new ICAL.Time instance from the the passed data object.
- Overrides
hour :Number
The hour of this date-time.
- Number
- Overrides
(constant) icalclass :String
The class identifier.
- String
- Overrides
- Default Value
- "vcardtime"
- Source
icaltype :String
The type name, to be used in the jCal object.
- String
- Overrides
- Default Value
- "date-and-or-time"
- Source
isDate :Boolean
If true, the instance represents a date (as opposed to a date-time)
- Boolean
- Overrides
minute :Number
The minute of this date-time.
- Number
- Overrides
month :Number
The month of this date.
- Number
- Overrides
second :Number
The second of this date-time.
- Number
- Overrides
year :Number
The year of this date.
- Number
- Overrides
zone :ICAL.Timezone
The timezone for this time.
- Overrides
Methods
addDuration(aDuration)
Adds the duration to the current time. The instance is modified in place.
| Name | Type | Description |
|---|---|---|
aDuration | ICAL. | The duration to add |
- Overrides
adjust(aExtraDays, aExtraHours, aExtraMinutes, aExtraSeconds, aTimeopt)
Adjust the date/time by the given offset
| Name | Type | Attributes | Description |
|---|---|---|---|
aExtraDays | Number | The extra amount of days | |
aExtraHours | Number | The extra amount of hours | |
aExtraMinutes | Number | The extra amount of minutes | |
aExtraSeconds | Number | The extra amount of seconds | |
aTime | Number | <optional> | The time to adjust, defaults to the current instance. |
- Overrides
clone() → {ICAL.VCardTime}
Returns a clone of the vcard date/time object.
- Overrides
- Source
The cloned object
- Type:
- ICAL.
VCardTime
compare(aOther) → {Number}
Compares the ICAL.Time instance with another one, or a period.
| Name | Type | Description |
|---|---|---|
aOther | ICAL. | The instance to compare with |
- Overrides
-1, 0 or 1 for less/equal/greater
- Type:
- Number
compareDateOnlyTz(other, tz) → {Number}
Compares only the date part of this instance with another one.
| Name | Type | Description |
|---|---|---|
other | ICAL. | The instance to compare with |
tz | ICAL. | The timezone to compare in |
- Overrides
-1, 0 or 1 for less/equal/greater
- Type:
- Number
convertToZone(zone) → {ICAL.Time}
Convert the instance into another timezone. The returned ICAL.Time instance is always a copy.
| Name | Type | Description |
|---|---|---|
zone | ICAL. | The zone to convert to |
- Overrides
The copy, converted to the zone
- Type:
- ICAL.
Time
dayOfWeek(aWeekStartopt) → {ICAL.Time.weekDay}
Calculate the day of week.
| Name | Type | Attributes | Description |
|---|---|---|---|
aWeekStart | ICAL. | <optional> | The week start weekday, defaults to SUNDAY |
- Overrides
- Type:
- ICAL.
Time. weekDay
dayOfYear() → {Number}
Calculate the day of year.
- Overrides
- Type:
- Number
endOfMonth() → {ICAL.Time}
Returns a copy of the current date/time, shifted to the end of the month. The resulting ICAL.Time instance is of icaltype date, even if this is a date-time.
- Overrides
The end of the month (cloned)
- Type:
- ICAL.
Time
endOfWeek(aWeekStartopt) → {ICAL.Time}
Returns a copy of the current date/time, shifted to the end of the week. The resulting ICAL.Time instance is of icaltype date, even if this is a date-time.
| Name | Type | Attributes | Description |
|---|---|---|---|
aWeekStart | ICAL. | <optional> | The week start weekday, defaults to SUNDAY |
- Overrides
The end of the week (cloned)
- Type:
- ICAL.
Time
endOfYear() → {ICAL.Time}
Returns a copy of the current date/time, shifted to the end of the year. The resulting ICAL.Time instance is of icaltype date, even if this is a date-time.
- Overrides
The end of the year (cloned)
- Type:
- ICAL.
Time
fromJSDate(aDatenullable, useUTCopt)
Set up the current instance from the Javascript date value.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
aDate | Date | <nullable> | The Javascript Date to read, or null to reset | |
useUTC | Boolean | <optional> | false | If true, the UTC values of the date will be used |
- Overrides
fromUnixTime(seconds)
Sets up the current instance from unix time, the number of seconds since January 1st, 1970.
| Name | Type | Description |
|---|---|---|
seconds | Number | The seconds to set up with |
- Overrides
getDominicalLetter(yr) → {String}
Get the dominical letter for the current year. Letters range from A - G for common years, and AG to GF for leap years.
| Name | Type | Description |
|---|---|---|
yr | Number | The year to retrieve the letter for |
- Overrides
The dominical letter.
- Type:
- String
isNthWeekDay(aDayOfWeek, aPos) → {Boolean}
Checks if current time is the nth weekday, relative to the current month. Will always return false when rule resolves outside of current month.
| Name | Type | Description |
|---|---|---|
aDayOfWeek | ICAL. | Day of week to check |
aPos | Number | Relative position |
- Overrides
True, if it is the nth weekday
- Type:
- Boolean
nthWeekDay(aDayOfWeek, aPos) → {Number}
Finds the nthWeekDay relative to the current month (not day). The returned value is a day relative the month that this month belongs to so 1 would indicate the first of the month and 40 would indicate a day in the following month.
| Name | Type | Description |
|---|---|---|
aDayOfWeek | Number | Day of the week see the day name constants |
aPos | Number | Nth occurrence of a given week day values of 1 and 0 both indicate the first weekday of that type. aPos may be either positive or negative |
- Overrides
numeric value indicating a day relative to the current month of this time object
- Type:
- Number
reset()
Reset the time instance to epoch time
- Overrides
resetTo(year, month, day, hour, minute, second, timezone)
Reset the time instance to the given date/time values.
| Name | Type | Description |
|---|---|---|
year | Number | The year to set |
month | Number | The month to set |
day | Number | The day to set |
hour | Number | The hour to set |
minute | Number | The minute to set |
second | Number | The second to set |
timezone | ICAL. | The timezone to set |
- Overrides
startDoyWeek(aFirstDayOfWeekopt) → {Number}
First calculates the start of the week, then returns the day of year for this date. If the day falls into the previous year, the day is zero or negative.
| Name | Type | Attributes | Description |
|---|---|---|---|
aFirstDayOfWeek | ICAL. | <optional> | The week start weekday, defaults to SUNDAY |
- Overrides
The calculated day of year
- Type:
- Number
startOfMonth() → {ICAL.Time}
Returns a copy of the current date/time, rewound to the start of the month. The resulting ICAL.Time instance is of icaltype date, even if this is a date-time.
- Overrides
The start of the month (cloned)
- Type:
- ICAL.
Time
startOfWeek(aWeekStartopt) → {ICAL.Time}
Returns a copy of the current date/time, rewound to the start of the week. The resulting ICAL.Time instance is of icaltype date, even if this is a date-time.
| Name | Type | Attributes | Description |
|---|---|---|---|
aWeekStart | ICAL. | <optional> | The week start weekday, defaults to SUNDAY |
- Overrides
The start of the week (cloned)
- Type:
- ICAL.
Time
startOfYear() → {ICAL.Time}
Returns a copy of the current date/time, rewound to the start of the year. The resulting ICAL.Time instance is of icaltype date, even if this is a date-time.
- Overrides
The start of the year (cloned)
- Type:
- ICAL.
Time
subtractDate(aDate) → {ICAL.Duration}
Subtract the date details (excluding timezone). Useful for finding the relative difference between two time objects excluding their timezone differences.
| Name | Type | Description |
|---|---|---|
aDate | ICAL. | The date to subtract |
- Overrides
The difference as a duration
- Type:
- ICAL.
Duration
subtractDateTz(aDate) → {ICAL.Duration}
Subtract the date details, taking timezones into account.
| Name | Type | Description |
|---|---|---|
aDate | ICAL. | The date to subtract |
- Overrides
The difference in duration
- Type:
- ICAL.
Duration
toICALString() → {String}
Returns an RFC 6350 compliant representation of this object.
- Overrides
- Source
vcard date/time string
- Type:
- String
toJSDate() → {Date}
Converts the current instance to a Javascript date
- Overrides
- Type:
- Date
toJSON() → {Object}
Converts time to into Object which can be serialized then re-created using the constructor.
- Overrides
- Type:
- Object
// toJSON will automatically be called
var json = JSON.stringify(mytime);
var deserialized = JSON.parse(json);
var time = new ICAL.Time(deserialized);toString() → {String}
The string representation of this date/time, in jCard form (including : and - separators).
- Overrides
- Source
- Type:
- String
toUnixTime() → {Number}
Converts the current instance to seconds since January 1st 1970.
- Overrides
Seconds since 1970
- Type:
- Number
utcOffset() → {Number}
Calculates the UTC offset of the current date/time in the timezone it is in.
- Overrides
UTC offset in seconds
- Type:
- Number
weekNumber(aWeekStart) → {Number}
Calculates the ISO 8601 week number. The first week of a year is the week that contains the first Thursday. The year can have 53 weeks, if January 1st is a Friday.
Note there are regions where the first week of the year is the one that starts on January 1st, which may offset the week number. Also, if a different week start is specified, this will also affect the week number.
| Name | Type | Description |
|---|---|---|
aWeekStart | ICAL. | The weekday the week starts with |
- Overrides
- See
- Time.weekOneStarts
The ISO week number
- Type:
- Number
(static) fromDateAndOrTimeString(aValue, aIcalType) → {ICAL.VCardTime}
Returns a new ICAL.VCardTime instance from a date and/or time string.
| Name | Type | Description |
|---|---|---|
aValue | String | The string to create from |
aIcalType | String | The type for this instance, e.g. date-and-or-time |
- Source
The date/time instance
- Type:
- ICAL.
VCardTime