prolificinteractive / Caishen

A Payment Card UI & Validator for iOS
MIT License
766 stars 119 forks source link

Have Expiry class handle MM/YY format #2

Closed ThibaultKlein closed 8 years ago

ThibaultKlein commented 8 years ago

Currently the Expiry class needs a MM/YYYY format, can we have it handle MM/YY?

Haud commented 8 years ago

Can you elaborate?

ThibaultKlein commented 8 years ago

In Expiry class the convenient init says:

/**
     Creates a `CardExpiry` with the given string.
     - parameter string: A string of the form MM/YYYY.
*/
public convenience init?(string: String)

I want to pass a MM/YY format instead.

Haud commented 8 years ago

Check out my PR which releats to refactoring Expiry:

https://github.com/prolificinteractive/Caishen/pull/1

You should be able to pass in a two-digit number and it will automatically parse it out.

Haud commented 8 years ago

@ThibaultKlein This format should be handled. Our unit tests cover the case of MM/yy. Can you give me an example or something not working?

ThibaultKlein commented 8 years ago

I just read the code and didn't find MM/YY in the documentation which is why I created this issue. If your unit tests cover this format you can close this issue. :+1:

Maybe update the documentation to mention that MM/YY format is also available.