Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toggling locales does not take effect #368

Open
stopfstedt opened this issue Nov 18, 2021 · 0 comments
Open

toggling locales does not take effect #368

stopfstedt opened this issue Nov 18, 2021 · 0 comments

Comments

@stopfstedt
Copy link

stopfstedt commented Nov 18, 2021

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:

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');
  }
}
{{this.firstDayOfWeek}}

<button type="button" {{on "click" this.changeLocale}}>Change Locale</button>

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant