From d52aca45e0357b5597e13d9b74998abb75fabea5 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 16 Feb 2012 10:54:48 -0800 Subject: integrating the latest montage fixes for v0.6 into master Signed-off-by: Valerio Virgillito --- node_modules/montage/core/converter/converter.js | 10 ---------- node_modules/montage/core/converter/date-converter.js | 10 +++++----- 2 files changed, 5 insertions(+), 15 deletions(-) (limited to 'node_modules/montage/core/converter') diff --git a/node_modules/montage/core/converter/converter.js b/node_modules/montage/core/converter/converter.js index abce44e2..a23d2702 100755 --- a/node_modules/montage/core/converter/converter.js +++ b/node_modules/montage/core/converter/converter.js @@ -20,16 +20,6 @@ var FUNCTION_CLASS = '[object Function]', var _toString = Object.prototype.toString; -// TODO should maybe move these into String.isString and Number.isNumber to parallel Array.isArray - -/** - @exports module:montage/core/converter#isString - @function -*/ -var isString = function(object) { - return _toString.call(object) === STRING_CLASS; -}; -exports.isString = isString; /** @exports module:montage/core/converter#isNumber diff --git a/node_modules/montage/core/converter/date-converter.js b/node_modules/montage/core/converter/date-converter.js index f0d3e540..f484f7aa 100755 --- a/node_modules/montage/core/converter/date-converter.js +++ b/node_modules/montage/core/converter/date-converter.js @@ -2502,16 +2502,13 @@ var _toString = Object.prototype.toString; var isDate = function(object) { return _toString.call(object) === DATE_CLASS; }; -var isString = function(object) { - return _toString.call(object) === STRING_CLASS; -}; var isNumber = function(object) { return _toString.call(object) === NUMBER_CLASS; }; var formatDate = function(v, format) { var date; - if (isString(v)) { + if (String.isString(v)) { // try to create a Date instance from the string // date must be a string that can be parsed by Date // see - http://www.w3schools.com/jsref/jsref_parse.asp @@ -2605,7 +2602,7 @@ var DateConverter = exports.DateConverter = Montage.create(Converter,/** @lends */ convert: { value: function(v) { - if (isDate(v) || isString(v) || isNumber(v)) { + if (isDate(v) || String.isString(v) || isNumber(v)) { return formatDate(v, this.pattern); } return v; @@ -2617,6 +2614,9 @@ var DateConverter = exports.DateConverter = Montage.create(Converter,/** @lends */ revert: { value: function(v) { + if(isDate(v)) { + return v; + } this.validator.pattern = this.pattern; var result = this.validator.validate(v); -- cgit v1.2.3