This is my timestamp = "2020-05-29T17:43:39.622832+05:30". How can I pass it to a function readTimeStamp (it will give me error of not type of int)?
date = DateTime.parse(bookDetails.timestamp);
print(readTimestamp(date));
String readTimestamp(int timestamp) {
var now = DateTime.now();
var date = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
var diff = now.difference(date);
String time = '';
if (diff.inSeconds <= 0 ||
diff.inSeconds > 0 && diff.inMinutes == 0 ||
diff.inMinutes > 0 && diff.inHours == 0 ||
diff.inHours > 0 && diff.inDays == 0) {
} else if (diff.inDays > 0 && diff.inDays < 7) {
if (diff.inDays == 1) {
time = diff.inDays.toString() + ' DAY AGO';
} else {
time = diff.inDays.toString() + ' DAYS AGO';
}
} else {
if (diff.inDays == 7) {
time = (diff.inDays / 7).floor().toString() + ' WEEK AGO';
} else {
time = (diff.inDays / 7).floor().toString() + ' WEEKS AGO';
}
}
return time;
}
This is my function to return value like 3 day ago and all.
DateTime.parse returns a DateTime. readTimestamp appears to expect the number of seconds since the epoch, so you just need to use DateTime.millisecondsSinceEpoch and convert milliseconds to seconds:
print(readTimestamp(date.millisecondsSinceEpoch ~/ 1000));
Personally, if you control the readTimestamp function, I would rename its ambiguous timestamp argument to secondsSinceEpoch to make it clear what it expects. Even better would be to change its argument to take a DateTime directly instead of doing unnecessary DateTime <=> milliseconds <=> seconds conversions.
bool isAfterToday(Timestamp timestamp) {
return DateTime.now().toUtc().isAfter(
DateTime.fromMillisecondsSinceEpoch(
timestamp.millisecondsSinceEpoch,
isUtc: false,
).toUtc(),
);
}
Related
I would like to compare last_uploaded_time with current time.
How to check whether the two time is more or less than one minute?
bool compareTime(String starts) {
print(starts);
var start = starts.split(":");
DateTime currentDateTime = DateTime.now();
String currentTime =
DateFormat(DateUtil.TIME_FORMAT).format(currentDateTime);
print(currentTime);
var end = currentTime.split(":");
DateTime initDateTime = DateTime(
currentDateTime.year, currentDateTime.month, currentDateTime.day);
var startDate = (initDateTime.add(Duration(hours: int.parse(start[0]))))
.add(Duration(minutes: int.parse(start[1])));
var endDate = (initDateTime.add(Duration(hours: int.parse(end[0]))))
.add(Duration(minutes: int.parse(end[1])));
if (currentDateTime.isBefore(endDate) &&
currentDateTime.isAfter(startDate)) {
print("CURRENT datetime is between START and END datetime");
return true;
} else {
print("NOT BETWEEN");
return false;
}
}
Output
I/flutter (12908): 01:16
I/flutter (12908): 01:40
I/flutter (12908): NOT BETWEEN
difference
not exactly working with minutes and seconds so you can use some custom algorithm like
import 'package:intl/intl.dart';
class IntelModel { static String timeSinceDate(DateTime date) {
final now = DateTime.now();
final difference = now.toLocal().difference(date.toLocal());
if ((now.day - date.day) >= 8) {
return 'A few weeks ago';
} else if ((now.day - date.day) >= 1) {
return '${(now.day - date.day)} days ago';
} else if (now.day == date.day) {
if (now.hour > date.hour) {
if ((now.hour - date.hour) >= 2) {
if (now.minute == date.minute) {
return '${(now.hour - date.hour)} hours ago';
} else {
var mins = now.minute - date.minute;
if (mins > 1) {
return '${(now.hour - date.hour)} h ${(now.minute - date.minute)} minutes ago';
} else {
return '${(now.hour - date.hour) - 1} h ${60 + mins} minutes ago';
}
}
} else if ((now.hour - date.hour) == 1) {
int timeMin = now.minute + (60 - date.minute);
if (timeMin == 60) {
return '1 hours ago';
} else if (timeMin >= 60) {
return '1 h ${timeMin - 60} mins ago';
} else {
return '$timeMin minutes ago';
}
}
} else if (now.hour == date.hour) {
if (now.minute > date.minute) {
return '${(now.minute - date.minute)} minutes ago';
} else if (date.minute == now.minute) {
return '${(now.second - date.second)} seconds ago';
}
}
} else {
return 'Error in time';
} } }
void main() {
String getDifference(DateTime date){
Duration duration = DateTime.now().difference(date);
String differenceInMinutes = (duration.inMinutes).toString();
return differenceInMinutes;
}
String str = getDifference(DateTime.parse('2021-09-24'));
print (str);
}
i tried above code on dartpad, you can use this to compare tow dateTime variables. As per above example, you can get more options to compare for eg duration.inDays,duration.inHours,duration.inSeconds etc.
I have created a function that receives a String date and returns a string that shows the time between the given date and the current DateTime in the format: x days ago, x months ago, just now, x years ago, yesterday, etc:
This is the code for that function:
String tiempoDesdeFecha(String dateString, {bool numericDates = true}) {
DateTime date = DateTime.parse(dateString);
final date2 = DateTime.now();
final difference = date2.difference(date);
if ((difference.inDays / 365).floor() >= 2) {
return "hace".tr()+'${(difference.inDays / 365).floor()}'+"yearsago".tr();
} else if ((difference.inDays / 365).floor() >= 1 ) {
return (numericDates) ? '1yearago'.tr() : 'lastyear'.tr()+" "+(numericDates).toString();
} else if ((difference.inDays / 30).floor() >= 2) {
return "hace".tr()+'${(difference.inDays / 365).floor()}'+"monthsago".tr();
} else if ((difference.inDays / 30).floor() >= 1) {
return (numericDates) ? '1monthago'.tr() : 'lastmonth'.tr();
} else if ((difference.inDays / 7).floor() >= 2) {
return "hace".tr()+'${(difference.inDays / 7).floor()}'+ 'weeksago'.tr();
} else if ((difference.inDays / 7).floor() >= 1) {
return (numericDates) ? "1weekago".tr() : 'lastweek'.tr();
} else if (difference.inDays >= 2) {
return "hace".tr()+'${difference.inDays}'+ 'daysago'.tr();
} else if (difference.inDays >= 1) {
return (numericDates) ? '1dayago'.tr() : 'yesterday'.tr();
} else if (difference.inHours >= 2) {
return "hace".tr()+'${difference.inHours}'+ 'hoursago'.tr();
} else if (difference.inHours >= 1) {
return (numericDates) ? '1hourago'.tr() : 'anhourago'.tr();
} else if (difference.inMinutes >= 2) {
return "hace".tr()+'${difference.inMinutes} ' +'minutesago'.tr();
} else if (difference.inMinutes >= 1) {
return (numericDates) ? '1minuteago'.tr() : 'aminuteago'.tr();
} else if (difference.inSeconds >= 3) {
return "hace".tr()+'${difference.inSeconds}'+ 'secondsago'.tr();
} else {
return 'justnow'.tr();
}
}
I have included the code to show the returned string in one of the four Locale I am using.
Everything is working fine, but the condition:
else if ((difference.inDays / 30).floor() >= 2) {
return "hace".tr()+'${(difference.inDays / 365).floor()}'+"monthsago".tr();
which is always returning 0 months ago.
I am calling the function from:
fecha_recibida = DateFormat('yyyy-MM-dd HH:mm',"en").format(date);
fecha_recibida = tiempoDesdeFecha(fecha_recibida);
I am testing that issue with following String date:
"2021-5-5 19:34"
What am I doing wrong?
I believe the error is in the returned string,
difference.inDays / 365 must be difference.inDays / 30.
So the condition should look like..
else if ((difference.inDays / 30).floor() >= 2) {
return "hace".tr()+'${(difference.inDays / 30).floor()}'+"monthsago".tr();
A plus, as #aman mentioned, you could use timeago package
I want to check if the current time is between my opening time and my closing time, knowing that the close time can some times be 2 am and the opening time is 3 am, for example, I have been trying to handle this problem logically for 2 weeks now and I can't wrap my head around it, this is my best try yet:
open = new DateTime(now.year, now.month, now.day, open.hour, open.minute);
close = new DateTime(now.year, now.month, now.day, close.hour, close.minute);
midnight = new DateTime(now.year, now.month, now.day, midnight.hour, midnight.minute);
if(close.hour > midnight.hour && close.hour < open.hour){
if(now.hour < midnight.hour){
DateTime theClose = new DateTime(now.year, now.month, now.day + 1, close.hour, close.minute);
if(now.isBefore(theClose) && now.isAfter(open)){
sendIt(context, notes);
}else{
_showToast("this branch is closed right now");
}
}else{
open = new DateTime(now.year, now.month, now.day - 1, open.hour, open.minute);
if(now.isBefore(close) && now.isAfter(open)){
sendIt(context, notes);
}else{
_showToast("this branch is closed right now");
}
}
}else{
if(now.isBefore(close) && now.isAfter(open)){
sendIt(context, notes);
}else{
_showToast("this branch is closed right now");
}
}
//checks if restaurant is open or closed
// returns true if current time is in between given timestamps
//openTime HH:MMAM or HH:MMPM same for closedTime
bool checkRestaurentStatus(String openTime, String closedTime) {
//NOTE: Time should be as given format only
//10:00PM
//10:00AM
// 01:60PM ->13:60
//Hrs:Min
//if AM then its ok but if PM then? 12+time (12+10=22)
TimeOfDay timeNow = TimeOfDay.now();
String openHr = openTime.substring(0, 2);
String openMin = openTime.substring(3, 5);
String openAmPm = openTime.substring(5);
TimeOfDay timeOpen;
if (openAmPm == "AM") {
//am case
if (openHr == "12") {
//if 12AM then time is 00
timeOpen = TimeOfDay(hour: 00, minute: int.parse(openMin));
} else {
timeOpen =
TimeOfDay(hour: int.parse(openHr), minute: int.parse(openMin));
}
} else {
//pm case
if (openHr == "12") {
//if 12PM means as it is
timeOpen =
TimeOfDay(hour: int.parse(openHr), minute: int.parse(openMin));
} else {
//add +12 to conv time to 24hr format
timeOpen =
TimeOfDay(hour: int.parse(openHr) + 12, minute: int.parse(openMin));
}
}
String closeHr = closedTime.substring(0, 2);
String closeMin = closedTime.substring(3, 5);
String closeAmPm = closedTime.substring(5);
TimeOfDay timeClose;
if (closeAmPm == "AM") {
//am case
if (closeHr == "12") {
timeClose = TimeOfDay(hour: 0, minute: int.parse(closeMin));
} else {
timeClose =
TimeOfDay(hour: int.parse(closeHr), minute: int.parse(closeMin));
}
} else {
//pm case
if (closeHr == "12") {
timeClose =
TimeOfDay(hour: int.parse(closeHr), minute: int.parse(closeMin));
} else {
timeClose = TimeOfDay(
hour: int.parse(closeHr) + 12, minute: int.parse(closeMin));
}
}
int nowInMinutes = timeNow.hour * 60 + timeNow.minute;
int openTimeInMinutes = timeOpen.hour * 60 + timeOpen.minute;
int closeTimeInMinutes = timeClose.hour * 60 + timeClose.minute;
//handling day change ie pm to am
if ((closeTimeInMinutes - openTimeInMinutes) < 0) {
closeTimeInMinutes = closeTimeInMinutes + 1440;
if (nowInMinutes >= 0 && nowInMinutes < openTimeInMinutes) {
nowInMinutes = nowInMinutes + 1440;
}
if (openTimeInMinutes < nowInMinutes &&
nowInMinutes < closeTimeInMinutes) {
return true;
}
} else if (openTimeInMinutes < nowInMinutes &&
nowInMinutes < closeTimeInMinutes) {
return true;
}
return false;
}
bool isValidTimeRange(TimeOfDay startTime, TimeOfDay endTime) {
TimeOfDay now = TimeOfDay.now();
return ((now.hour > startTime.hour) || (now.hour == startTime.hour && now.minute >= startTime.minute))
&& ((now.hour < endTime.hour) || (now.hour == endTime.hour && now.minute <= endTime.minute));
}
As you have noticed, using DateTime in our case is not the best solution because it relies on the month/year/day.
Instead, we can make use of the TimeOfDay class that does not rely on a specific day, but only on the time:
List<TimeOfDay> openingTimeRange = [TimeOfDay(hour: 2, minute: 30), TimeOfDay(hour: 15, minute: 45)]; // as an example
bool isOpen(List<TimeOfDay> openingTimeRange) {
TimeOfDay now = TimeOfDay.now();
return now.hour >= openingTimeRange[0].hour
&& now.minute >= openingTimeRange[0].minute
&& now.hour <= openingTimeRange[1].hour
&& now.minute <= openingTimeRange[1].minute;
}
I have a simple solution if your time format is in 24 hours. For that you don't require any external library.
bool _getStoreOpenStatus(String openTime, String closeTime) {
bool result = false;
DateTime now = DateTime.now();
int nowHour = now.hour;
int nowMin = now.minute;
print('Now: H$nowHour M$nowMin');
var openTimes = openTime.split(":");
int openHour = int.parse(openTimes[0]);
int openMin = int.parse(openTimes[1]);
print('OpenTimes: H$openHour M$openMin');
var closeTimes = closeTime.split(":");
int closeHour = int.parse(closeTimes[0]);
int closeMin = int.parse(closeTimes[1]);
print('CloseTimes: H$closeHour M$closeMin');
if(nowHour >= openHour && nowHour <= closeHour) {
if(nowMin > openMin && nowMin < closeMin) result = true;
}
return result;
}
If you use your time in the digital format [0..23] for hours, then you can convert the time to the amount of seconds that have past in that day. Do the same for the ranges you would like to check and see whether the current time past in seconds are between the two number ranges (in seconds):
TimeOfDay now = TimeOfDay.now(); // or DateTime object
TimeOfDay openingTime = TimeOfDay(hours: ??, minutes:??); // or leave as DateTime object
TimeOfDay closingTime = TimeOfDay(hours: ??, minutes:??); // or leave as DateTime object
int shopOpenTimeInSeconds = openingTime.hour * 60 + openingTime.minute;
int shopCloseTimeInSeconds = closingTime.hour * 60 + closingTime.minute;
int timeNowInSeconds = now.hour * 60 + now.minute;
if (shopOpenTimeInSeconds <= timeNowInSeconds &&
timeNowInSeconds <= shopCloseTimeInSeconds) {
// OPEN;
} else {
// CLOSED;
}
How do we convert specific time format ("yyyy-MM-dd-HH-mm-ss") to calculate time ago in Flutter? I have the codes below for my android app, however I am trying out Flutter which uses Dart. Can someone provide a pointer here on how we can achieve this?
Date currentDate = Calendar.getInstance().getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", locale);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String dd = sdf.format(newsDate);
Date gmt = null;
try {
gmt = sdf.parse(dd);
} catch (ParseException e) {
e.printStackTrace();
}
long duration = currentDate.getTime() - gmt.getTime();
long diffInSeconds = TimeUnit.MILLISECONDS.toSeconds(duration);
long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(duration);
long diffInHours = TimeUnit.MILLISECONDS.toHours(duration);
long diffInDays = TimeUnit.MILLISECONDS.toDays(duration);
This is how I've implemented it:
String timeAgoSinceDate({bool numericDates = true}) {
DateTime date = this.createdTime.toLocal();
final date2 = DateTime.now().toLocal();
final difference = date2.difference(date);
if (difference.inSeconds < 5) {
return 'Just now';
} else if (difference.inSeconds <= 60) {
return '${difference.inSeconds} seconds ago';
} else if (difference.inMinutes <= 1) {
return (numericDates) ? '1 minute ago' : 'A minute ago';
} else if (difference.inMinutes <= 60) {
return '${difference.inMinutes} minutes ago';
} else if (difference.inHours <= 1) {
return (numericDates) ? '1 hour ago' : 'An hour ago';
} else if (difference.inHours <= 60) {
return '${difference.inHours} hours ago';
} else if (difference.inDays <= 1) {
return (numericDates) ? '1 day ago' : 'Yesterday';
} else if (difference.inDays <= 6) {
return '${difference.inDays} days ago';
} else if ((difference.inDays / 7).ceil() <= 1) {
return (numericDates) ? '1 week ago' : 'Last week';
} else if ((difference.inDays / 7).ceil() <= 4) {
return '${(difference.inDays / 7).ceil()} weeks ago';
} else if ((difference.inDays / 30).ceil() <= 1) {
return (numericDates) ? '1 month ago' : 'Last month';
} else if ((difference.inDays / 30).ceil() <= 30) {
return '${(difference.inDays / 30).ceil()} months ago';
} else if ((difference.inDays / 365).ceil() <= 1) {
return (numericDates) ? '1 year ago' : 'Last year';
}
return '${(difference.inDays / 365).floor()} years ago';
}
then for example, you can embed it inside of an object, and call it like this:
Text(viewmodel.post.timeAgoSinceDate())
The question is how to format a Dart DateTime as a string stating the time elapsed similar to the way you see times displayed on Stack Overflow.
Is there any better method than this
String timeAgo(DateTime d) {
Duration diff = DateTime.now().difference(d);
if (diff.inDays > 365)
return "${(diff.inDays / 365).floor()} ${(diff.inDays / 365).floor() == 1 ? "year" : "years"} ago";
if (diff.inDays > 30)
return "${(diff.inDays / 30).floor()} ${(diff.inDays / 30).floor() == 1 ? "month" : "months"} ago";
if (diff.inDays > 7)
return "${(diff.inDays / 7).floor()} ${(diff.inDays / 7).floor() == 1 ? "week" : "weeks"} ago";
if (diff.inDays > 0)
return "${diff.inDays} ${diff.inDays == 1 ? "day" : "days"} ago";
if (diff.inHours > 0)
return "${diff.inHours} ${diff.inHours == 1 ? "hour" : "hours"} ago";
if (diff.inMinutes > 0)
return "${diff.inMinutes} ${diff.inMinutes == 1 ? "minute" : "minutes"} ago";
return "just now";
}
Thank you and hope it helps others
I used timeago for the exact purpose and found it quite useful. It has multiple format and different languages support as well.
You can also try this package, Jiffy.
You can get relative time from now
// This returns time ago from now
Jiffy().fromNow(); // a few seconds ago
//You can also pass in a DateTime Object or a string or a list
Jiffy(DateTime.now()).fromNow; // a few seconds ago
//or
Jiffy(DateTime(2018, 10, 25)).fromNow(); // a year ago
Jiffy("2020-10-25").fromNow(); // in a year
Manipulating is also simple in Jiffy
var dateTime = Jiffy().add(hours: 3, months: 2);
dateTime.fromNow(); // in 2 months
You can also get relative time from a specified time apart from now
Jiffy([2022, 10, 25]).from([2022, 1, 25]); // in 10 months
I simplify Paresh's answer by using DateTime extension
create a new dart file called date_time_extension.dart and then write code like this
extension DateTimeExtension on DateTime {
String timeAgo({bool numericDates = true}) {
final date2 = DateTime.now();
final difference = date2.difference(this);
if ((difference.inDays / 7).floor() >= 1) {
return (numericDates) ? '1 week ago' : 'Last week';
} else if (difference.inDays >= 2) {
return '${difference.inDays} days ago';
} else if (difference.inDays >= 1) {
return (numericDates) ? '1 day ago' : 'Yesterday';
} else if (difference.inHours >= 2) {
return '${difference.inHours} hours ago';
} else if (difference.inHours >= 1) {
return (numericDates) ? '1 hour ago' : 'An hour ago';
} else if (difference.inMinutes >= 2) {
return '${difference.inMinutes} minutes ago';
} else if (difference.inMinutes >= 1) {
return (numericDates) ? '1 minute ago' : 'A minute ago';
} else if (difference.inSeconds >= 3) {
return '${difference.inSeconds} seconds ago';
} else {
return 'Just now';
}
}
}
and then, use it like this
import 'package:utilities/extensions/date_time_extension.dart'; // <--- import the file you just create
product.createdAt.timeAgo(numericDates: false) // use it on your DateTime property
If you just want to use Datetime library this is the way you can do it.
void main() {
final currentTime = DateTime.now();
print('Current time: $currentTime');
final threeWeeksAgo = currentTime.subtract(const Duration(days: 21));
print('Three weeks ago: $threeWeeksAgo');
}
This is what you get:
Current time: 2022-09-29 11:26:58.350
Three weeks ago: 2022-09-08 11:26:58.350
String timeAgoCustom(DateTime d) { // <-- Custom method Time Show (Display Example ==> 'Today 7:00 PM') // WhatsApp Time Show Status Shimila
Duration diff = DateTime.now().difference(d);
if (diff.inDays > 365)
return "${(diff.inDays / 365).floor()} ${(diff.inDays / 365).floor() == 1 ? "year" : "years"} ago";
if (diff.inDays > 30)
return "${(diff.inDays / 30).floor()} ${(diff.inDays / 30).floor() == 1 ? "month" : "months"} ago";
if (diff.inDays > 7)
return "${(diff.inDays / 7).floor()} ${(diff.inDays / 7).floor() == 1 ? "week" : "weeks"} ago";
if (diff.inDays > 0)
return "${DateFormat.E().add_jm().format(d)}";
if (diff.inHours > 0)
return "Today ${DateFormat('jm').format(d)}";
if (diff.inMinutes > 0)
return "${diff.inMinutes} ${diff.inMinutes == 1 ? "minute" : "minutes"} ago";
return "just now";
}
Add This Package --> intl: ^0.17.0
Time Show Example (Today 8:29 PM)
You can use this Method which will give you times ago.
String convertToAgo(String dateTime) {
DateTime input =
DateFormat('yyyy-MM-DDTHH:mm:ss.SSSSSSZ').parse(dateTime, true);
Duration diff = DateTime.now().difference(input);
if (diff.inDays >= 1) {
return '${diff.inDays} day${diff.inDays == 1 ? '' : 's'} ago';
} else if (diff.inHours >= 1) {
return '${diff.inHours} hour${diff.inHours == 1 ? '' : 's'} ago';
} else if (diff.inMinutes >= 1) {
return '${diff.inMinutes} minute${diff.inMinutes == 1 ? '' : 's'} ago';
} else if (diff.inSeconds >= 1) {
return '${diff.inSeconds} second${diff.inSeconds == 1 ? '' : 's'} ago';
} else {
return 'just now';
}
}
Hope you got the answer! you just need to past your timestamp value in this method and you get a time ago formatted string.
String getVerboseDateTimeRepresentation(DateTime dateTime) {
DateTime now = DateTime.now().toLocal();
DateTime localDateTime = dateTime.toLocal();
if (localDateTime.difference(now).inDays == 0) {
var differenceInHours = localDateTime.difference(now).inHours.abs();
var differenceInMins = localDateTime.difference(now).inMinutes.abs();
if (differenceInHours > 0) {
return '$differenceInHours hours ago';
} else if (differenceInMins > 2) {
return '$differenceInMins mins ago';
} else {
return 'Just now';
}
}
String roughTimeString = DateFormat('jm').format(dateTime);
if (localDateTime.day == now.day &&
localDateTime.month == now.month &&
localDateTime.year == now.year) {
return roughTimeString;
}
DateTime yesterday = now.subtract(const Duration(days: 1));
if (localDateTime.day == yesterday.day &&
localDateTime.month == now.month &&
localDateTime.year == now.year) {
return 'Yesterday';
}
if (now.difference(localDateTime).inDays < 4) {
String weekday = DateFormat(
'EEEE',
).format(localDateTime);
return '$weekday, $roughTimeString';
}
return '${DateFormat('yMd').format(dateTime)}, $roughTimeString';
}
A variation on #Alex289's answer
extension DateHelpers on DateTime {
String toTimeAgoLabel({bool isIntervalNumericVisible = true}) {
final now = DateTime.now();
final durationSinceNow = now.difference(this);
final inDays = durationSinceNow.inDays;
if (inDays >= 1) {
return (inDays / 7).floor() >= 1
? isIntervalNumericVisible ? '1 week ago' : 'Last week'
: inDays >= 2
? '$inDays days ago'
: isIntervalNumericVisible
? '1 day ago'
: 'Yesterday';
}
final inHours = durationSinceNow.inHours;
if (inHours >= 1) {
return inHours >= 2
? '$inHours hours ago'
: isIntervalNumericVisible
? '1 hour ago'
: 'An hour ago';
}
final inMinutes = durationSinceNow.inMinutes;
if (inMinutes >= 2) {
return inMinutes >= 2
? '$inMinutes minutes ago'
: isIntervalNumericVisible
? '1 minute ago'
: 'A minute ago';
}
final inSeconds = durationSinceNow.inSeconds;
return inSeconds >= 3 ? '$inSeconds seconds ago' : 'Just now';
}
}