adopted-ember-addons / ember-inputmask

Ember wrapper around Inputmask.js
https://adopted-ember-addons.github.io/ember-inputmask/
MIT License
68 stars 45 forks source link

one-way-input-mask with custom mask does not work after upgrade #114

Open wuarmin opened 4 years ago

wuarmin commented 4 years ago

Hi, following setup worked properly with ember-inputmask versions < 0.7

//mask-definition
import Inputmask from 'inputmask';

export function initialize(/* application */) {
  Inputmask.extendAliases({
    euro: {
      suffix: " €",
      groupSeparator: ".",
      radixPoint: ",",
      alias: "numeric",
      placeholder: "0",
      autoGroup: !0,
      digits: 2,
      digitsOptional: !1,
      clearMaskOnLostFocus: !1,
      autoUnmask: true,
      unmaskAsNumber: true
    }
  });
}

export default {
  initialize
};
{{one-way-input-mask value=12.58 mask="euro"}}

image Since ember-inputmask > 0.7, the same output results in following output: image The given value (12.58) is multiplicated by 100. Why? Can you help me?

thank you

brandynbennett commented 4 years ago

It looks like this is an ongoing issue with Inputmask.js. See: https://github.com/RobinHerbots/Inputmask/issues/1655 However, it looks like a fix is coming 🤞 from https://github.com/RobinHerbots/Inputmask/commit/8177635957c0ad298e20e36277ed287608db5001

Best advice I can give right now is if you have data that already exists that you want to display, to format the numbers yourself so that the input will understand them. Then typing from there should work fine. This sucks, but hopefully in the 5.0 release of Inputmask.js it will work as expected

{{one-way-number-mask 
  value='12,58'
  decimal=true
  options=(hash
    suffix=" €"
    groupSeparator='.'
    radixPoint=',')}}