Closed electricessence closed 10 years ago
Need to be considerate of localization.
Something like this:
var elapsed = this.elapsed.time, a:string[] = [];
if(elapsed.days)
a.push(pluralize(elapsed.days,"day"));
if(elapsed.hours)
a.push(pluralize(elapsed.hours,"hour"));
if(elapsed.minutes)
a.push(pluralize(elapsed.minutes,"minute"));
if(elapsed.seconds)
a.push(pluralize(elapsed.seconds,"second"));
if(a.length>1)
a.splice(a.length-1,0,"and");
return a.join(", ").replace(", and, "," and ");
Is simply a super useful feature to display time in a formatted string.