goog.date.relative
Namespace.format(dateMs)
Accepts a timestamp in milliseconds and outputs a relative time in the form of "1 hour ago", "1 day ago", "in 1 hour", "in 2 days" etc. If the date delta is over 2 weeks, then the output string will be empty.
dateMs
{number
}
string
}
.formatDay(dateMs)
Accepts a timestamp in milliseconds and outputs a relative day. i.e. "Today", "Yesterday" or "Sept 15".
dateMs
{number
}
string
}
.formatPast(dateMs)
Accepts a timestamp in milliseconds and outputs a relative time in the form of "1 hour ago", "1 day ago". All future times will be returned as 0 minutes ago. This is provided for compatibility with users of the previous incarnation of the above {@see #format} method who relied on it protecting against future dates.
dateMs
{number
}
string
}
.getDateString(date, opt_shortTimeMsg, opt_fullDateMsg)
Formats a date, adding the relative date in parenthesis. If the date is less than 24 hours then the time will be printed, otherwise the full-date will be used. Examples: 2:20 PM (1 minute ago) Monday, February 27, 2009 (4 days ago) Tuesday, March 20, 2005 // Too long ago for a relative date.
date
{Date
|goog.date.DateTime
}
opt_shortTimeMsg
{string
=}
opt_fullDateMsg
{string
=}
string
}
.getPastDateString(date, opt_shortTimeMsg, opt_fullDateMsg)
Formats a date, adding the relative date in parenthesis. Functions the same as #getDateString but ensures that the date is always seen to be in the past. If the date is in the future, it will be shown as 0 minutes ago. This is provided for compatibility with users of the previous incarnation of the above {@see #getDateString} method who relied on it protecting against future dates.
date
{Date
|goog.date.DateTime
}
opt_shortTimeMsg
{string
=}
opt_fullDateMsg
{string
=}
string
}