YUI~toRelativeTime Class
Provides a method Y.toRelativeTime(Date, refDate) to translate a Date instance to a string like "2 days ago". If the second parameter is provided, the time delta is in reference to this date.
Methods
toRelativeTime
(
String
-
d
-
from
Parameters:
-
d
Datethe Date to translate.
-
from
Date(optional) reference Date. Default is now.
Returns:
String:
the delta between from and d, in human readable form
Properties
toRelativeTime.strings
Object
The strings to use for relative times. Represent Numbers (minutes, hours, days) as X (e.g. "about X hours ago"). Keys are now, seconds, minute, minutes, hour, hours, day, and days.