toFuzzyDate

Converts a certain date/time to a fuzzy string.

Parameters

time SysTime

The point in time to convert to a fuzzy string

Return Value

Type: string

The non-range based overloads will return the fuzzy representation as a string

Examples

SysTime tm(string timestr) { return SysTime.fromISOExtString(timestr); }
assert(toFuzzyDate(tm("2015-11-12T19:59:59Z"), tm("2015-11-12T20:00:00Z")) == "just now");
assert(toFuzzyDate(tm("2015-11-12T19:58:55Z"), tm("2015-11-12T20:00:00Z")) == "a minute ago");
assert(toFuzzyDate(tm("2015-11-02T12:00:00Z"), tm("2015-11-12T20:00:00Z")) == "10 days ago");
assert(toFuzzyDate(tm("2014-06-06T12:00:00Z"), tm("2015-11-12T20:00:00Z")) == "a year ago");

Meta