You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2013/05/24 02:48:05 UTC
git commit: [flex-sdk] [refs/heads/develop] - FLEX-14596 Changed Z to
be timezone name and made 0 formatting more flexible so it can pad or not
hours or not show minutes
Updated Branches:
refs/heads/develop 47620c5ce -> 0647e68ab
FLEX-14596 Changed Z to be timezone name and made 0 formatting more flexible so it can pad or not hours or not show minutes
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/0647e68a
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/0647e68a
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/0647e68a
Branch: refs/heads/develop
Commit: 0647e68ab4bf821f7af6091141ff8146753ba8c6
Parents: 47620c5
Author: Justin Mclean <jm...@apache.org>
Authored: Fri May 24 10:47:51 2013 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Fri May 24 10:47:51 2013 +1000
----------------------------------------------------------------------
.../framework/src/mx/formatters/DateBase.as | 76 +++++++++++++--
.../framework/src/mx/formatters/DateFormatter.as | 21 ++++
2 files changed, 90 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/0647e68a/frameworks/projects/framework/src/mx/formatters/DateBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/formatters/DateBase.as b/frameworks/projects/framework/src/mx/formatters/DateBase.as
index ab7de2d..97cdba1 100644
--- a/frameworks/projects/framework/src/mx/formatters/DateBase.as
+++ b/frameworks/projects/framework/src/mx/formatters/DateBase.as
@@ -368,7 +368,64 @@ public class DateBase
_timeOfDay = value != null ? value : [ am, pm ];
}
-
+
+ /**
+ * @private
+ */
+ private static var _timezoneName:String = "GMT";
+
+ /**
+ * Timezone name.
+ *
+ * @default "GMT"
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Apache Flex 4.10
+ */
+ public static function get timezoneName():String
+ {
+ return _timezoneName;
+ }
+
+ /**
+ * @private
+ */
+ public static function set timezoneName(value:String):void
+ {
+ _timezoneName = value;
+ }
+
+ /**
+ * @private
+ */
+ private static var _timezoneHourMinuteSeperator:String = ":";
+
+ /**
+ * Timezone hour/minute seperator.
+ *
+ * @default ":"
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Apache Flex 4.10
+ */
+ public static function get timezoneHourMinuteSeperator():String
+ {
+ return _timezoneHourMinuteSeperator;
+ }
+
+ /**
+ * @private
+ */
+ public static function set timezoneHourMinuteSeperator(value:String):void
+ {
+ _timezoneHourMinuteSeperator = value;
+ }
+
+
//--------------------------------------------------------------------------
//
// Class methods
@@ -565,6 +622,12 @@ public class DateBase
}
case "Z":
+ {
+ // timezone offset
+ result += timezoneName;
+ return result;
+ }
+
case "O":
{
// timezone offset
@@ -573,13 +636,12 @@ public class DateBase
mins = offset - hours*60;
var tzStr:String = "";
- if (tokenInfo.token == "Z")
- tzStr = "Z";
-
- if (key < 2 && mins == 0)
+ if (key <= 2 && mins == 0)
tzStr += setValue(hours, key);
- else if (key < 3)
- tzStr += setValue(hours, key) + ":" + setValue(mins, key);
+ else
+ tzStr += setValue(hours, key-2)
+ + timezoneHourMinuteSeperator
+ + setValue(mins, 2);
if (offset >= 0)
tzStr = "+" + tzStr;
http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/0647e68a/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 f81fb12..79d8e2d 100644
--- a/frameworks/projects/framework/src/mx/formatters/DateFormatter.as
+++ b/frameworks/projects/framework/src/mx/formatters/DateFormatter.as
@@ -588,6 +588,27 @@ public class DateFormatter extends Formatter
* <li>QQQ = 078</li>
* </ul></td>
* </tr>
+ * <tr>
+ * <td>O</td>
+ * <td>Timezone offset
+ *
+ * <p>Example:</p>
+ * <ul>
+ * <li>O = +7</li>
+ * <li>OO = -08</li>
+ * <li>OOO = +4:30</li>
+ * <li>OOO = -08:30</li>
+ * </ul></td>
+ * </tr>
+ * <tr>
+ * <td>Z</td>
+ * <td>Timezone name
+ *
+ * <p>Example:</p>
+ * <ul>
+ * <li>Z = GMT</li>
+ * </ul></td>
+ * </tr>
* <tr>
* <td>Other text</td>
* <td>You can add other text into the pattern string to further