- Source:
Methods
(static) format(diff, optionsopt) → {timeDiff}
- Source:
Formats a time interval between two timestamps.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
diff |
number | A UNIX timestamps difference in seconds. | ||||||||||||||||
options |
object |
<optional> |
An optional object with additional options.
Properties
|
Returns:
A time difference type object.
- Type
- timeDiff
(static) refreshInterval(value, refresh, granularity) → {number}
- Source:
Computes the refresh interval.
There are cases when the refresh occurs even when it is not needed. For
example if the refresh interval is '10 seconds', the granularity is 2 and
the time difference is '1 hour 32 minutes', there's no need to refresh
every 10 seconds but every 1 minute. This function optimizes the refresh
interval to higher values, if the structure of the time difference
doesn't require refreshing more often.
Parameters:
Name | Type | Description |
---|---|---|
value |
timeDiffValue | The time difference object. |
refresh |
number | The configured refresh interval in seconds. |
granularity |
number | The time difference granularity. |
Returns:
The computed refresh interval in seconds.
- Type
- number
(static) show(timeElement)
- Source:
Fills a HTML5 time element text with a computed time difference string.
Parameters:
Name | Type | Description |
---|---|---|
timeElement |
Element | The time DOM element. |