adopted-ember-addons / adopted-ember-addons/ember-moment
toggling locales does not take effect
- Lenguaje dominante
- JavaScript
- Estrellas
- 398
- Forks
- 120
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
after upgrading to version 9.0.1, toggling the locale does not seem to cause a re-computation in the getters of my glimmer components that use the `moment` service.
example component and corresponding template:
```javascript
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { inject as service } from '@ember/service';
export default class MyComponent extends Component {
@service moment;
/**
* the first day of the this week.
* is locale dependent, e.g. with "en" locale that value would be "Sunday"
* but with "es" locale it would be "lunes" (Monday)
*/
get firstDayOfWeek() {
return this.moment.moment().startOf('week').format('dddd');
}
@action
changeLocale() {
this.moment.setLocale('es');
}
}
```
```handlebars
{{this.firstDayOfWeek}}
Change Locale
```
i would expect that once i change the locale (invoking the `changeLocale()` action via a button click or the likes), that "lunes" would be returned from the getter, but it doesn't - it still gives me "Sunday".
this appears to be a regression, version 8 was working as expected.
Guía de contribución
Línea de trabajo
Start by reproducing the issue with the Glimmer component and template shown in the report, then trace the moment service's setLocale entry point and the firstDayOfWeek getter. Done means changing the locale causes the getter output to update from "Sunday" to the locale-specific value such as "lunes".
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- frontend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100