only call date function if needed in Ox.formatDate

This commit is contained in:
j 2014-02-02 08:59:45 +00:00 committed by rolux
parent 2077ea718a
commit 37d9424ec8

View file

@ -348,7 +348,9 @@ Ox.formatDate <f> Formats a date according to a format string
}
date = Ox.makeDate(date);
format.forEach(function(value) {
string = string.replace(value[0], value[1](date, utc));
string = string.replace(value[0], function() {
return value[1](date, utc);
});
});
return string;
};