Skip to content
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

Conversation

ocakliemre
Copy link
Contributor

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.

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 ocakliemre changed the title The cards expired date validation control bux fixed. The cards expired date validation control bug fixed. Nov 5, 2021
@DhavalRKansara
Copy link
Collaborator

@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?

@kavantrivedi
Copy link
Collaborator

@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?

@@ -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;
Copy link
Collaborator

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?

lib/credit_card_form.dart Outdated Show resolved Hide resolved
@@ -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),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, formatting issue

@kavantrivedi
Copy link
Collaborator

kavantrivedi commented Sep 9, 2022

Hey @ocakliemre,
Can you squash these commits, it would be better to get all changes in a single commit.

@ocakliemre ocakliemre force-pushed the expired-date-validation-bug-fix branch from 24ca037 to 52c1cf3 Compare September 9, 2022 08:55
@shwetachauhan-simform
Copy link
Contributor

@ocakliemre : You can squash all commit

@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check formatting

@shwetachauhan-simform shwetachauhan-simform merged commit 02b1b18 into SimformSolutionsPvtLtd:master Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants