-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kaushik
committed
Jun 24, 2024
1 parent
7f18066
commit 71e5c78
Showing
7 changed files
with
58 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
extension TimeAgoExtension on int? { | ||
String timeAgo() { | ||
if (this == null) return ""; | ||
|
||
final DateTime now = DateTime.now(); | ||
final DateTime date = DateTime.fromMillisecondsSinceEpoch(this!); | ||
|
||
final Duration diff = now.difference(date); | ||
|
||
if (diff.inSeconds < 60) { | ||
return "just now"; | ||
} else if (diff.inMinutes < 60) { | ||
return "${diff.inMinutes} minutes ago"; | ||
} else if (diff.inHours < 24) { | ||
return "${diff.inHours} hours ago"; | ||
} else if (diff.inDays < 7) { | ||
return "${diff.inDays} days ago"; | ||
} else if (diff.inDays < 30) { | ||
return "${diff.inDays ~/ 7} weeks ago"; | ||
} else if (diff.inDays < 365) { | ||
return "${diff.inDays ~/ 30} months ago"; | ||
} else { | ||
return "${diff.inDays ~/ 365} years ago"; | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
# This is a generated file; do not edit or check into version control. | ||
cloud_firestore=/Users/ishita/.pub-cache/hosted/pub.dev/cloud_firestore-4.17.5/ | ||
cloud_firestore_web=/Users/ishita/.pub-cache/hosted/pub.dev/cloud_firestore_web-3.12.5/ | ||
cloud_functions=/Users/ishita/.pub-cache/hosted/pub.dev/cloud_functions-4.7.6/ | ||
cloud_functions_web=/Users/ishita/.pub-cache/hosted/pub.dev/cloud_functions_web-4.9.6/ | ||
device_info_plus=/Users/ishita/.pub-cache/hosted/pub.dev/device_info_plus-9.1.2/ | ||
firebase_auth=/Users/ishita/.pub-cache/hosted/pub.dev/firebase_auth-4.20.0/ | ||
firebase_auth_web=/Users/ishita/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.0/ | ||
firebase_core=/Users/ishita/.pub-cache/hosted/pub.dev/firebase_core-2.32.0/ | ||
firebase_core_web=/Users/ishita/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/ | ||
firebase_storage=/Users/ishita/.pub-cache/hosted/pub.dev/firebase_storage-11.7.7/ | ||
firebase_storage_web=/Users/ishita/.pub-cache/hosted/pub.dev/firebase_storage_web-3.9.7/ | ||
flutter_timezone=/Users/ishita/.pub-cache/hosted/pub.dev/flutter_timezone-1.0.8/ | ||
google_sign_in=/Users/ishita/.pub-cache/hosted/pub.dev/google_sign_in-6.2.1/ | ||
google_sign_in_android=/Users/ishita/.pub-cache/hosted/pub.dev/google_sign_in_android-6.1.23/ | ||
google_sign_in_ios=/Users/ishita/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.6/ | ||
google_sign_in_web=/Users/ishita/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.3+3/ | ||
package_info_plus=/Users/ishita/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/ | ||
path_provider_linux=/Users/ishita/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ | ||
path_provider_windows=/Users/ishita/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ | ||
shared_preferences=/Users/ishita/.pub-cache/hosted/pub.dev/shared_preferences-2.2.3/ | ||
shared_preferences_android=/Users/ishita/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.2/ | ||
shared_preferences_foundation=/Users/ishita/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.4.0/ | ||
shared_preferences_linux=/Users/ishita/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/ | ||
shared_preferences_web=/Users/ishita/.pub-cache/hosted/pub.dev/shared_preferences_web-2.3.0/ | ||
shared_preferences_windows=/Users/ishita/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/ | ||
cloud_firestore=/home/kaushik/.pub-cache/hosted/pub.dev/cloud_firestore-4.17.5/ | ||
cloud_firestore_web=/home/kaushik/.pub-cache/hosted/pub.dev/cloud_firestore_web-3.12.5/ | ||
cloud_functions=/home/kaushik/.pub-cache/hosted/pub.dev/cloud_functions-4.7.6/ | ||
cloud_functions_web=/home/kaushik/.pub-cache/hosted/pub.dev/cloud_functions_web-4.9.6/ | ||
device_info_plus=/home/kaushik/.pub-cache/hosted/pub.dev/device_info_plus-9.1.2/ | ||
firebase_auth=/home/kaushik/.pub-cache/hosted/pub.dev/firebase_auth-4.20.0/ | ||
firebase_auth_web=/home/kaushik/.pub-cache/hosted/pub.dev/firebase_auth_web-5.12.0/ | ||
firebase_core=/home/kaushik/.pub-cache/hosted/pub.dev/firebase_core-2.32.0/ | ||
firebase_core_web=/home/kaushik/.pub-cache/hosted/pub.dev/firebase_core_web-2.17.1/ | ||
firebase_storage=/home/kaushik/.pub-cache/hosted/pub.dev/firebase_storage-11.7.7/ | ||
firebase_storage_web=/home/kaushik/.pub-cache/hosted/pub.dev/firebase_storage_web-3.9.7/ | ||
flutter_timezone=/home/kaushik/.pub-cache/hosted/pub.dev/flutter_timezone-1.0.8/ | ||
google_sign_in=/home/kaushik/.pub-cache/hosted/pub.dev/google_sign_in-6.2.1/ | ||
google_sign_in_android=/home/kaushik/.pub-cache/hosted/pub.dev/google_sign_in_android-6.1.24/ | ||
google_sign_in_ios=/home/kaushik/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.7.6/ | ||
google_sign_in_web=/home/kaushik/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.4/ | ||
package_info_plus=/home/kaushik/.pub-cache/hosted/pub.dev/package_info_plus-8.0.0/ | ||
path_provider_linux=/home/kaushik/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/ | ||
path_provider_windows=/home/kaushik/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/ | ||
shared_preferences=/home/kaushik/.pub-cache/hosted/pub.dev/shared_preferences-2.2.3/ | ||
shared_preferences_android=/home/kaushik/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.3/ | ||
shared_preferences_foundation=/home/kaushik/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.4.0/ | ||
shared_preferences_linux=/home/kaushik/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/ | ||
shared_preferences_web=/home/kaushik/.pub-cache/hosted/pub.dev/shared_preferences_web-2.3.0/ | ||
shared_preferences_windows=/home/kaushik/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/ |
Large diffs are not rendered by default.
Oops, something went wrong.