Created
June 24, 2021 06:51
-
-
Save naimurhasan/0555f108846caccc10c6c0357c0d5f90 to your computer and use it in GitHub Desktop.
Dart is Expired
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
import 'package:intl/intl.dart'; | |
* MAKE A FUNCTION TO CHECK EXPIRE | |
* */ | |
bool isExpired(date) { | |
DateTime parseDate = DateFormat("yyyy-MM-dd").parse(date); | |
var inputDate = DateTime.parse(parseDate.toString()); | |
var todayDate = DateTime.now(); | |
final difference = inputDate.difference(todayDate).inDays; | |
return difference < 0; | |
} | |
isSubscriptionValidToday() { | |
if (this._membershipEndDate != null) { | |
return !this.isExpired(this._membershipEndDate); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment