|
|
|
@ -30,19 +30,28 @@ class Formatter extends \yii\base\Formatter
|
|
|
|
|
*/ |
|
|
|
|
public $locale; |
|
|
|
|
/** |
|
|
|
|
* @var string the default format string to be used to format a date using PHP date() function. |
|
|
|
|
* @var string the default format string to be used to format a date. |
|
|
|
|
* This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. |
|
|
|
|
* It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). |
|
|
|
|
*/ |
|
|
|
|
public $dateFormat = 'short'; |
|
|
|
|
/** |
|
|
|
|
* @var string the default format string to be used to format a time using PHP date() function. |
|
|
|
|
* @var string the default format string to be used to format a time. |
|
|
|
|
* This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. |
|
|
|
|
* It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). |
|
|
|
|
*/ |
|
|
|
|
public $timeFormat = 'short'; |
|
|
|
|
/** |
|
|
|
|
* @var string the default format string to be used to format a date and time using PHP date() function. |
|
|
|
|
* @var string the default format string to be used to format a date and time. |
|
|
|
|
* This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. |
|
|
|
|
* It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). |
|
|
|
|
*/ |
|
|
|
|
public $datetimeFormat = 'short'; |
|
|
|
|
/** |
|
|
|
|
* @var array the options to be set for the NumberFormatter objects. Please refer to |
|
|
|
|
* [PHP manual](http://php.net/manual/en/class.numberformatter.php#intl.numberformatter-constants.unumberformatattribute) |
|
|
|
|
* for the possible options. This property is used by [[createNumberFormatter]] when |
|
|
|
|
* creating a new number formatter to format decimals, currencies, etc. |
|
|
|
|
*/ |
|
|
|
|
public $numberFormatOptions = array(); |
|
|
|
|
|
|
|
|
@ -81,8 +90,11 @@ class Formatter extends \yii\base\Formatter
|
|
|
|
|
* - a PHP DateTime object |
|
|
|
|
* |
|
|
|
|
* @param string $format the format used to convert the value into a date string. |
|
|
|
|
* If null, [[dateFormat]] will be used. The format string should be the one |
|
|
|
|
* that can be recognized by the PHP `date()` function. |
|
|
|
|
* If null, [[dateFormat]] will be used. |
|
|
|
|
* |
|
|
|
|
* This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. |
|
|
|
|
* It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). |
|
|
|
|
* |
|
|
|
|
* @return string the formatted result |
|
|
|
|
* @see dateFormat |
|
|
|
|
*/ |
|
|
|
@ -111,8 +123,11 @@ class Formatter extends \yii\base\Formatter
|
|
|
|
|
* - a PHP DateTime object |
|
|
|
|
* |
|
|
|
|
* @param string $format the format used to convert the value into a date string. |
|
|
|
|
* If null, [[dateFormat]] will be used. The format string should be the one |
|
|
|
|
* that can be recognized by the PHP `date()` function. |
|
|
|
|
* If null, [[dateFormat]] will be used. |
|
|
|
|
* |
|
|
|
|
* This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. |
|
|
|
|
* It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). |
|
|
|
|
* |
|
|
|
|
* @return string the formatted result |
|
|
|
|
* @see timeFormat |
|
|
|
|
*/ |
|
|
|
@ -141,8 +156,11 @@ class Formatter extends \yii\base\Formatter
|
|
|
|
|
* - a PHP DateTime object |
|
|
|
|
* |
|
|
|
|
* @param string $format the format used to convert the value into a date string. |
|
|
|
|
* If null, [[dateFormat]] will be used. The format string should be the one |
|
|
|
|
* that can be recognized by the PHP `date()` function. |
|
|
|
|
* If null, [[dateFormat]] will be used. |
|
|
|
|
* |
|
|
|
|
* This can be "short", "medium", "long", or "full", which represents a preset format of different lengths. |
|
|
|
|
* It can also be a custom format as specified in the [ICU manual](http://userguide.icu-project.org/formatparse/datetime). |
|
|
|
|
* |
|
|
|
|
* @return string the formatted result |
|
|
|
|
* @see datetimeFormat |
|
|
|
|
*/ |
|
|
|
@ -213,7 +231,7 @@ class Formatter extends \yii\base\Formatter
|
|
|
|
|
/** |
|
|
|
|
* Creates a number formatter based on the given type and format. |
|
|
|
|
* @param integer $type the type of the number formatter |
|
|
|
|
* @param string $format the format to be used |
|
|
|
|
* @param string $format the format to be used. Please refer to [ICU manual](http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details) |
|
|
|
|
* @return NumberFormatter the created formatter instance |
|
|
|
|
*/ |
|
|
|
|
protected function createNumberFormatter($type, $format) |
|
|
|
|