Permalink
Browse files

Added localized MONTH_NAMES 'constant' to DateUtil.

  • Loading branch information...
1 parent 083b775 commit 3af9b0f169fcc067384b77cb4b4e5091637fcc1a @johnyanarella johnyanarella committed Mar 20, 2011
Showing with 40 additions and 0 deletions.
  1. BIN bin/flex-extensions.swc
  2. +40 −0 src/com/codecatalyst/util/DateUtil.as
View
Binary file not shown.
@@ -24,6 +24,8 @@ package com.codecatalyst.util
{
import com.codecatalyst.data.DateRange;
+ import mx.formatters.DateFormatter;
+
public class DateUtil
{
// ========================================
@@ -54,6 +56,44 @@ package com.codecatalyst.util
public static const FRIDAY:Number = 5;
public static const SATURDAY:Number = 6;
+ [ArrayElementType("String")]
+ /**
+ * Month names (localized).
+ */
+ public static function get MONTH_NAMES():Array
+ {
+ if ( _MONTH_NAMES == null )
+ {
+ _MONTH_NAMES = new Array();
+
+ var dateFormatter:DateFormatter = new DateFormatter();
+ dateFormatter.formatString = "MMMM";
+
+ var date:Date = new Date( 2011, 0, 1 );
+ for ( var month:int = 0; month < 12; month++ )
+ {
+ date.month = month;
+
+ _MONTH_NAMES.push( dateFormatter.format( date ) );
+ }
+ }
+
+ return _MONTH_NAMES;
+ }
+
+ // ========================================
+ // Protected constants
+ // ========================================
+
+ /**
+ * @private
+ *
+ * Backing variable for <code>MONTH_NAMES</code>.
+ *
+ * @see #MONTH_NAMES
+ */
+ protected static var _MONTH_NAMES:Array = null;
+
// ========================================
// Public methods
// ========================================

0 comments on commit 3af9b0f

Please sign in to comment.