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

Allow to override format methods in service #1684

Closed
2 tasks done
bobisjan opened this issue Jun 10, 2022 · 1 comment
Closed
2 tasks done

Allow to override format methods in service #1684

bobisjan opened this issue Jun 10, 2022 · 1 comment

Comments

@bobisjan
Copy link
Contributor

bobisjan commented Jun 10, 2022

  • I am on the latest ember-intl version
  • I have searched the issues of this repo and believe that this is not a duplicate

Steps to Reproduce

  1. Add own service app/services/intl.js
  2. Subclass service from ember-intl
  3. Override any of the format* methods
import EmberIntl from 'ember-intl/services/intl';

export default class IntlService extends EmberIntl {

  formatDate(date, options) {
    // do something custom
    return super.formatDate(...arguments)
  }
}
  1. service.formatDate() calls original method-as-property instead of the custom method 💥

I'm not sure if this is intentional or format* methods should be defined as prototype methods on class to allow/fix standard/expected behaviour?

bobisjan added a commit to zonkyio/ember-intl that referenced this issue Jun 12, 2022
bobisjan added a commit to zonkyio/ember-intl that referenced this issue Jun 12, 2022
bobisjan added a commit to zonkyio/ember-intl that referenced this issue Jun 12, 2022
bobisjan added a commit to zonkyio/ember-intl that referenced this issue Jun 12, 2022
bobisjan added a commit to zonkyio/ember-intl that referenced this issue Jun 12, 2022
@ijlee2
Copy link
Contributor

ijlee2 commented May 20, 2024

Will close this issue. Rather than inheritance, end-developers are encouraged to inject the intl service (composition).

@ijlee2 ijlee2 closed this as completed May 20, 2024
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

2 participants