From e6f075f88ea05e3cbb3c57d691e28ca742660e48 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 2 Nov 2011 16:21:09 +0100 Subject: [PATCH] change Ox.formatDate so that Ox.formatDate('', "%a, %b %e, %Y") returns '' and not "undefined, undefined Na, NaN" --- source/Ox.UI/js/List/Ox.List.js | 2 +- source/Ox/js/Format.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 16bf871b..f5b7418d 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -1375,7 +1375,7 @@ Ox.List = function(options, self) { self.options.items.sort(function(a, b) { var aValue = sort[a.id], bValue = sort[b.id], - ret = 0 + ret = 0; if (aValue < bValue) { ret = operator == '+' ? -1 : 1; } else if (aValue > bValue) { diff --git a/source/Ox/js/Format.js b/source/Ox/js/Format.js index a1cebb65..334e87d3 100644 --- a/source/Ox/js/Format.js +++ b/source/Ox/js/Format.js @@ -122,6 +122,9 @@ Ox.formatDate Formats a date according to a format string Ox.formatDate = function(date, str, utc) { // fixme: date and utc are optional, date can be date, number or string + if (date == '') { + return ''; + } date = Ox.makeDate(date); var format = [ ['%', function() {return '%{%}';}], @@ -546,4 +549,4 @@ Ox.formatUnit Formats a number with a unit @*/ Ox.formatUnit = function(num, str) { return Ox.formatNumber(num, 3) + ' ' + str; -}; \ No newline at end of file +};