Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Added localized MONTH_NAMES 'constant' to DateUtil.
  • Loading branch information
John Yanarella committed Mar 20, 2011
1 parent 083b775 commit 3af9b0f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Binary file modified bin/flex-extensions.swc
Binary file not shown.
40 changes: 40 additions & 0 deletions src/com/codecatalyst/util/DateUtil.as
Expand Up @@ -24,6 +24,8 @@ package com.codecatalyst.util
{
import com.codecatalyst.data.DateRange;

import mx.formatters.DateFormatter;

public class DateUtil
{
// ========================================
Expand Down Expand Up @@ -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
// ========================================
Expand Down

0 comments on commit 3af9b0f

Please sign in to comment.