public static string ToApproximateAgeString(this DateTime fromDate) { AgeSpan age = fromDate.GetAge(); if (Math.Abs(age.TotalMinutes) <= 1.0) { if (age.TotalSeconds <= 0.0) { return("Right now"); } return("Just now"); } if (age.TotalSeconds > 0.0) { return(age.ToString(1, false, false) + " ago"); } return(age.ToString(1, false, false) + " from now"); }
public static string ToWords(this TimeSpan span, bool shortForm, int maxParts) { AgeSpan span2 = new AgeSpan(span); return(span2.ToString(maxParts, shortForm, false)); }