Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1D2FC10E34 for ; Tue, 8 Oct 2013 15:11:37 +0000 (UTC) Received: (qmail 41698 invoked by uid 500); 8 Oct 2013 15:11:36 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 41651 invoked by uid 500); 8 Oct 2013 15:11:36 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 41037 invoked by uid 99); 8 Oct 2013 15:11:35 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Oct 2013 15:11:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 55DC191295D; Tue, 8 Oct 2013 15:11:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jmclean@apache.org To: commits@flex.apache.org Message-Id: <98c938f9531d4b0aa02bc7aaf99f8bf7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-sdk] [refs/heads/develop] - FLEX-33807 fixed parsing of dates with no seperators Date: Tue, 8 Oct 2013 15:11:35 +0000 (UTC) Updated Branches: refs/heads/develop 6cf64f2fe -> 7639423c7 FLEX-33807 fixed parsing of dates with no seperators Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/7639423c Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/7639423c Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/7639423c Branch: refs/heads/develop Commit: 7639423c798492a4673f32a73e333a9cea75163a Parents: 6cf64f2 Author: Justin Mclean Authored: Wed Oct 9 02:11:08 2013 +1100 Committer: Justin Mclean Committed: Wed Oct 9 02:11:08 2013 +1100 ---------------------------------------------------------------------- .../framework/src/mx/validators/DateValidator.as | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/7639423c/frameworks/projects/framework/src/mx/validators/DateValidator.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/validators/DateValidator.as b/frameworks/projects/framework/src/mx/validators/DateValidator.as index b082502..89138cc 100644 --- a/frameworks/projects/framework/src/mx/validators/DateValidator.as +++ b/frameworks/projects/framework/src/mx/validators/DateValidator.as @@ -173,6 +173,7 @@ public class DateValidator extends Validator var part:int = -1; var lastFormatChar:String = ""; + var noSeperators:Boolean = true; n = inputFormat.length; for (i = 0; i < n; i++) @@ -209,6 +210,7 @@ public class DateValidator extends Validator } else { + noSeperators = false; formatParts[part] = formatChar; } @@ -318,6 +320,7 @@ public class DateValidator extends Validator else { var lastStringChar:String = ""; + lastFormatChar = ""; n = stringValue.length; part = -1; for (i = 0; i < n; i++) @@ -327,6 +330,7 @@ public class DateValidator extends Validator && (lastStringChar != ""); var curentIsDigit:Boolean = (DECIMAL_DIGITS.indexOf(stringChar) >= 0); + formatChar = inputFormat.charAt(i); if (validInput.indexOf(stringChar) == -1) { results.push(new ValidationResult( @@ -339,12 +343,19 @@ public class DateValidator extends Validator part++; dateParts[part] = stringChar; } + // TODO will only work if month and day are not specified as single digits + else if (lastFormatChar != formatChar && noSeperators) + { + part++; + dateParts[part] = stringChar; + } else { dateParts[part] += stringChar; } lastStringChar = stringChar; + lastFormatChar = formatChar; } if (formatParts.length != dateParts.length)