Skip to content

Commit

Permalink
Merge pull request #55 from thaidmfinnick/develop
Browse files Browse the repository at this point in the history
build: draft
  • Loading branch information
thaidmfinnick authored Jan 5, 2025
2 parents eb4a2a5 + 626482d commit d407b4f
Show file tree
Hide file tree
Showing 7 changed files with 354 additions and 55 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ If all files are decrypted, done! You can run code normally.
## Roadmap
- iOS/Android Push Notification
- Custom time schedule for sending reminder notification to users
- ZNS to forgot password flow
- ZNS to forgot password flow (on my way to find another solution)
- Export Excel statistics

## Contact
Expand Down
28 changes: 28 additions & 0 deletions mobile/lib/constants/extension/datetime_extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import 'package:intl/intl.dart';

extension DateOnlyCompare on DateTime {
bool isSameDate(DateTime other) {
return year == other.year && month == other.month && day == other.day;
}
bool isLowerDate(DateTime other) {
return year < other.year || month < other.month || day < other.day;
}
bool isBiggerDate(DateTime other) {
return year > other.year || month > other.month || day > other.day;
}
int get weekNumber {
int dayOfYear = int.parse(DateFormat("D").format(this));
int woy = ((dayOfYear - weekday + 10) / 7).ceil();
if (woy < 1) {
woy = _numOfWeeks(year - 1);
} else if (woy > _numOfWeeks(year)) {
woy = 1;
}
return woy;
}
int _numOfWeeks(int year) {
DateTime dec28 = DateTime(year, 12, 28);
int dayOfDec28 = int.parse(DateFormat("D").format(dec28));
return ((dayOfDec28 - dec28.weekday + 10) / 7).ceil();
}
}
Loading

0 comments on commit d407b4f

Please sign in to comment.