medipass / react-payment-inputs

A React Hook & Container to help with payment card input fields.
https://medipass.github.io/react-payment-inputs
381 stars 63 forks source link

Expiration date being formatted after onChange callback is being called #16

Closed dsizomin closed 5 years ago

dsizomin commented 5 years ago

Problem description

In current implementation onChange callback is being called before the expiration date field value is being formatted.

That means that consumer will rely on a wrong state of the field while trying to read the value.

Proposed solution

Update field with formatted value before firing the onChange callback.

jxom commented 5 years ago

Thanks legend! I also did the same for the card number which will hopefully fix #13. Published on 1.0.7