I know there is a more readable way of writing this:
var string = (
(r.d != 0 ? r.d + (r.d == 1 ? ' day' : ' days') : '' ) +
(r.h != 0 ? r.h + (r.h == 1 ? ' hour' : ' hours') : '' ) +
(r.m != 0 ? r.m + (r.m == 1 ? ' minute' : ' minutes') : '' ) +
(r.s != 0 ? r.s + (r.s == 1 ? ' second' : ' seconds') : '' ));