TF-2298 Write unit test to check token expired time
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit 3fc44a33c509e186a3bc5d2434169f44dcfe4169)
This commit is contained in:
@@ -17,9 +17,16 @@ extension DateTimeExtension on DateTime {
|
||||
}
|
||||
|
||||
int daysBetween(DateTime from) {
|
||||
from = DateTime(from.year, from.month, from.day);
|
||||
final to = DateTime(year, month, day);
|
||||
return (to.difference(from).inHours / 24).round().abs();
|
||||
from = DateTime(from.year, from.month, from.day, from.hour);
|
||||
final to = DateTime(year, month, day, hour);
|
||||
return (to.difference(from).inHours / Duration.hoursPerDay).round().abs();
|
||||
}
|
||||
|
||||
|
||||
int minutesBetween(DateTime from) {
|
||||
from = DateTime(from.year, from.month, from.day, from.hour, from.minute);
|
||||
final to = DateTime(year, month, day, hour, minute);
|
||||
return to.difference(from).inMinutes.abs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user