FLEX-34209 fix parsing of hours between 12pm and 1pm

Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/30f46e8e
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/30f46e8e
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/30f46e8e

Branch: refs/heads/release4.12.0
Commit: 30f46e8e4d8e79abcc91405a787e309a40097c06
Parents: c5b0ff1
Author: Justin Mclean <jmcl...@apache.org>
Authored: Thu Apr 3 10:38:03 2014 +1100
Committer: Justin Mclean <jmcl...@apache.org>
Committed: Thu Apr 3 10:38:03 2014 +1100

----------------------------------------------------------------------
 .../framework/src/mx/formatters/DateFormatter.as        | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/30f46e8e/frameworks/projects/framework/src/mx/formatters/DateFormatter.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/formatters/DateFormatter.as 
b/frameworks/projects/framework/src/mx/formatters/DateFormatter.as
index 79d8e2d..fed3fc6 100644
--- a/frameworks/projects/framework/src/mx/formatters/DateFormatter.as
+++ b/frameworks/projects/framework/src/mx/formatters/DateFormatter.as
@@ -252,14 +252,14 @@ public class DateFormatter extends Formatter
                 }
                 marker = 0;
                                
-                               // Other lacales AM/PM 
+                               // All known locales AM/PM 
                                if (ampm.hasOwnProperty(word))
                                {
                                        isPM = true;
                                        
                                        if (hour > 12)
                                                break; // error
-                                       else if (hour >= 0)
+                                       else if (hour >= 0 && hour < 12)
                                                hour += 12;
                                }
             }
@@ -299,7 +299,7 @@ public class DateFormatter extends Formatter
                 }
 
                 // If the current letter is a slash or a dash,
-                // assign num to year or month or day or sec.
+                // assign num to year or month or day or min or sec.
                 else if (punctuation.hasOwnProperty(letter) && 
punctuation[letter].date)
                 {
                                        var monthFirst:Boolean = year != -1;
@@ -313,6 +313,8 @@ public class DateFormatter extends Formatter
                                                day = num;
                                        else if (!monthFirst && mon < 0)
                                                mon = (num -1);
+                                       else if (min < 0)
+                                               min = num;
                                        else if (sec < 0)
                                                sec = num;
                                        else if (milli < 0)
@@ -333,7 +335,7 @@ public class DateFormatter extends Formatter
                                                {
                                                        if (hour > 12)
                                                                break; //error
-                                                       else
+                                                       else if (hour >= 0 && 
hour < 12)
                                                                hour += 12;
                                                }
                                        }
@@ -387,7 +389,7 @@ public class DateFormatter extends Formatter
                     break;  //error
                 }
                 
-                marker = 0
+                marker = 0;
             }
         }
                

Reply via email to