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:
dab246
2023-12-04 10:57:31 +07:00
committed by Dat H. Pham
parent 5061fcaced
commit d152056473
4 changed files with 143 additions and 42 deletions
@@ -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();
}
}