RelativeTimeSpanStringResolver
A StringResolver that takes a time and resolves it to a String representation that shows the relative time.
When the instant of time represented by time is:
Within the last/next minute, shows:
now
.Within the last/next hour shows:
__ min(s) ago
orin __ min(s)
. For example:31 mins ago
for an instant of time 31 mins ago.More than an hour in the past or in the future, but within 24 hours of the current time, shows:
__ hr(s) ago
orin __ hr(s)
. For example:2 hrs ago
for a time 2 hours 59 mins ago.Yesterday/tomorrow shows the time in
HH:mm
orh:m
format with optionallyAM
/PM
based on the locale. For example:23:13
for a time tomorrow at 23 hours 13 mins.Within the last/next 7 days, shows the day of the week. For example:
Monday
for a time 7 days in the future.More than 7 days in the past/future, shows the date without the year. For example:
21 March
.More than a year in the past/future, shows the date with the year. For example:
21 March 2021
.
Parameters
The instant of time to calculate the relative time from.
indicates how often the underlying string should be updated.