-
Notifications
You must be signed in to change notification settings - Fork 271
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
The cards expired date validation control bug fixed. #66
The cards expired date validation control bug fixed. #66
Conversation
The expiry date on the cards should be based on the last day of that month. Since the current structure is based only on the month, it does not work correctly. As a bug fix, the last day of the month was found and added to the card expiry date.
@ocakliemre This branch is having conflicts with the latest release, can you please take upstream of the latest changes, fix the conflict and update the PR so we can review it? |
@ocakliemre just a reminder for resolving conflicts of this branch with the latest release, can you please update this PR so we can review it? |
Updated repo with latest master
lib/credit_card_form.dart
Outdated
@@ -247,7 +248,8 @@ class _CreditCardFormState extends State<CreditCardForm> { | |||
final List<String> date = value.split(RegExp(r'/')); | |||
final int month = int.parse(date.first); | |||
final int year = int.parse('20${date.last}'); | |||
final DateTime cardDate = DateTime(year, month); | |||
final int lastDayofMonth = DateTime(year, Jiffy( DateTime(year,month)).add(months: 1).month, 0 ).day; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ocakliemre can we use another way to get the last date of the month, as we do not want any additional package dependencies?
example/lib/main.dart
Outdated
@@ -190,8 +190,7 @@ class MySampleState extends State<MySample> { | |||
style: ElevatedButton.styleFrom( | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.circular(8.0), | |||
), | |||
primary: const Color(0xff1b447b), | |||
), backgroundColor: const Color(0xff1b447b), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, formatting issue
Hey @ocakliemre, |
24ca037
to
52c1cf3
Compare
@ocakliemre : You can squash all commit |
lib/credit_card_form.dart
Outdated
@@ -247,7 +245,8 @@ class _CreditCardFormState extends State<CreditCardForm> { | |||
final List<String> date = value.split(RegExp(r'/')); | |||
final int month = int.parse(date.first); | |||
final int year = int.parse('20${date.last}'); | |||
final DateTime cardDate = DateTime(year, month); | |||
final int lastDayOfMonth = month < 12 ? DateTime(year, month + 1, 0).day : DateTime(year + 1, 1, 0).day; | |||
final DateTime cardDate = DateTime(year, month, lastDayOfMonth,23,59,59,999); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check formatting
The expiry date on the cards should be based on the last day of that month. Since the current structure is based only on the month, it does validation not work correctly. As a bug fix, the last day of the month was found and added to the card expiry date.