I'm trying to show time difference between 2 date in my flutter app. How can I do so with my formatted date ? And I also need to show it as a string.
For example: 6 Jun 2022 14 Jun 2022 (8 Days)
Here's my current code:
Text(
'Created: ' +
DateFormat('d MMM y').format(
DateTime.parse(
ticketData['date_created']
.toDate()
.toString(),
),
),
style: primaryColor400Style.copyWith(
fontSize: fontSize13,
),
),
TextSpan(
text: DateFormat('d MMM y').format(
DateTime.parse(
ticketData['due_date']
.toDate()
.toString(),
),
),
style: weight400Style.copyWith(
fontSize: fontSize14,
color: hintColor,
),
),