Skip to content

Commit

Permalink
(Fixes issue 1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiang.xue committed Sep 1, 2010
1 parent 813f35c commit b2e94a7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -22,6 +22,7 @@ Version 1.1.4 to be released
- Bug #1493: ShellCommand wouldn't process logs after exiting. (Qiang)
- Bug #1521: CUniqueValidator may incorrectly fail the validation of a non-PK column when updating both this column and the PK column (Qiang)
- Enh #954: Refactored CActiveRecord and CActiveFinder so that CActiveRecord::with() always returns the AR object itself (Qiang)
- Enh #1019: Improved CDataFormatter for formatting numeric weekdays (Qiang)
- Enh #1073: Allow dependencies to be set in constructor of CChainedCacheDependency. Also allow dependencies to be specified as configurations. (Qiang)
- Enh #1087: Allow CDbCriteria to be used as dynamic relational query options (Qiang)
- Enh #1104: Added argument "$" to jQuery block to prevent $ alias conflict (mdomba)
Expand Down
19 changes: 18 additions & 1 deletion framework/i18n/CDateFormatter.php
Expand Up @@ -50,6 +50,8 @@ class CDateFormatter extends CComponent
'm'=>'formatMinutes',
's'=>'formatSeconds',
'E'=>'formatDayInWeek',
'c'=>'formatDayInWeek',
'e'=>'formatDayInWeek',
'D'=>'formatDayInYear',
'F'=>'formatDayInMonth',
'w'=>'formatWeekInYear',
Expand Down Expand Up @@ -285,6 +287,7 @@ protected function formatDayInYear($pattern,$date)
* @param string a pattern.
* @param array result of {@link CTimestamp::getdate}.
* @return int day in month
* @see http://www.unicode.org/reports/tr35/#Date_Format_Patterns
*/
protected function formatDayInMonth($pattern,$date)
{
Expand All @@ -302,6 +305,7 @@ protected function formatDayInMonth($pattern,$date)
* @param string a pattern.
* @param array result of {@link CTimestamp::getdate}.
* @return string day of the week.
* @see http://www.unicode.org/reports/tr35/#Date_Format_Patterns
*/
protected function formatDayInWeek($pattern,$date)
{
Expand All @@ -311,13 +315,26 @@ protected function formatDayInWeek($pattern,$date)
case 'E':
case 'EE':
case 'EEE':
case 'eee':
return $this->_locale->getWeekDayName($day,'abbreviated');
case 'EEEE':
case 'eeee':
return $this->_locale->getWeekDayName($day,'wide');
case 'EEEEE':
case 'eeeee':
return $this->_locale->getWeekDayName($day,'narrow');
case 'e':
case 'ee':
case 'c':
return $day ? $day : 7;
case 'ccc':
return $this->_locale->getWeekDayName($day,'abbreviated',true);
case 'cccc':
return $this->_locale->getWeekDayName($day,'wide',true);
case 'ccccc':
return $this->_locale->getWeekDayName($day,'narrow',true);
default:
throw new CException(Yii::t('yii','The pattern for day of the week must be "E", "EE", "EEE", "EEEE" or "EEEEE".'));
throw new CException(Yii::t('yii','The pattern for day of the week must be "E", "EE", "EEE", "EEEE", "EEEEE", "e", "ee", "eee", "eeee", "eeeee", "c", "cccc" or "ccccc".'));
}
}

Expand Down

0 comments on commit b2e94a7

Please sign in to comment.