In some cases (i.e:grouping by weekday in MySQL) you get the position of day in the week, but in order to make data readable you need to show week day name.
The common solution is create an array with weekday number and name, but in yii this implies making the week days translation again.
Having a function like getWeekdayName could solve this.
What i麓m doing to get the translated name is
Yii::$app->formatter->asDatetime(strtotime('Monday +{$dayNumber} days'), "E")
We have the data in intl's ICU bundles so technically possible.
@cebe what do you think?
How about month names etc?
:+1: for this. I always end up implementing my own Formatter where I add something like:
public function asWeekday($day, $format = 'EEEE', $firstDay = 'Sunday') {
return $this->asDate(strtotime("{$firstDay} +{$day} days"), $format);
}
I'm not sure it's worth spending of core team time, but acceptable as a PR.
Won't be implemented in 2.0.
Most helpful comment
How about month names etc?