diff --git a/source/Ox/js/Format.js b/source/Ox/js/Format.js index 212586bd..dfbe46f5 100644 --- a/source/Ox/js/Format.js +++ b/source/Ox/js/Format.js @@ -422,13 +422,13 @@ Ox.formatDateRangeDuration Formats the duration of a date range as a string Ox.formatDateRangeDuration = function(start, end, utc) { end = end || Ox.formatDate(new Date(), '%Y-%m-%d'); var date = Ox.parseDate(start, utc), - dates = [start, end].map(function(str) { - return Ox.parseDate(str, utc); + dates = [start, end].map(function(string) { + return Ox.parseDate(string, utc); }), keys = ['year', 'month', 'day', 'hour', 'minute', 'second'], parts = ['FullYear', 'Month', 'Date', 'Hours', 'Minutes', 'Seconds'], values = []; - keys.forEach(function(key, i) { + date && keys.forEach(function(key, i) { while (true) { if (key == 'month') { // set the day to the same day in the next month,