I am attempting to validate an expiry date for a given payment card (in my Android App). The user enters the expiry date using this month picker: https://github.com/premkumarroyal/MonthAndYearPicker
The date is stored in my EditText in MM/yy format. I now want to ensure that the date is not before todays date. To do so, i am trying to find out the last day of the month chosen and comparing it to today's date to see if the chosen day is before todays date (hence expired).
I was wondering how I can do this? Any help would be appreciated.
cardExpiryDate.getText().toString()
Gets the date selected by the user and converts into a string so its in the following format -> MM/yy
EDIT: It isn't a duplicate of the suggested link as that link compares two dates (which include days) whereas I have to convert a string in MM/yy form to dd/MM/yy (so that dd is the last date of that month) and then compare it to today's date.. I hope that made sense.