$time
Updated on Aug 29, 2025 4 minutes to readThe Time Plugin provides methods to work with time values including validation, arithmetic, component access, and difference calculation.
Methods
Method | Description |
---|---|
addHours | Adds a number of hours to a time value. |
addMinutes | Adds a number of minutes to a time value. |
addSeconds | Adds a number of seconds to a time value. |
current | Returns the current time. |
diff | Calculates the difference between two time values in a specified unit. |
hour | Gets or sets the hour component of a time value. |
isValid | Checks whether a value is a valid. |
minute | Gets or sets the minute component of a time value. |
second | Gets or sets the second component of a time value. |
Methods Details
addHours()
• Type
(value: E8Time, hours: number) => E8Time
• Details
addMinutes()
• Type
(value: E8Time, minutes: number) => E8Time
• Details
addSeconds()
• Type
(value: E8Time, seconds: number) => E8Time
• Details
current()
• Type
() => E8Time
• Details
Returns the current system time as a E8Time.
diff()
• Type
(
value1: E8Time,
value2: E8Time,
unit?: TimeUnit,
precise?: boolean
) => number
• Details
Expects two E8Time values and an optional TimeUnit (default: 'second'
) and precise flag (default: false
).
Returns the difference between the two times in the specified unit. If precise is false, the result is truncated to an integer.
hour()
• Type
/** Gets the hour component of a time value. */
(value: E8Time) => number;
/** Sets the hour component of a time value. */
(value: E8Time, hours: number) => E8Time;
• Details
Expects an E8Time, and optionally a number of hours to set.
Returns a number when called without the second argument; otherwise it returns an updated E8Time.
isValid()
• Type
(value: any) => boolean
• Details
Expects any value.
Returns true if the value is a valid E8Time, otherwise false.
minute()
• Type
/** Gets the minute component of a time value. */
(value: E8Time) => number;
/** Sets the minute component of a time value. */
(value: E8Time, minutes: number) => E8Time;
• Details
Expects an E8Time, and optionally a number of minutes to set.
Returns a number when called without the second argument; otherwise it returns an updated E8Time.
second()
• Type
/** Gets the second component of a time value. */
(value: E8Time) => number;
/** Sets the second component of a time value. */
(value: E8Time, seconds: number) => E8Time;
• Details