Add daysago formatter and extract common helper to reuse with indays formatter

This commit is contained in:
Jorge Manrubia
2025-04-05 13:24:46 +02:00
parent e30ddca439
commit 8e01a277ad
4 changed files with 33 additions and 32 deletions
+7
View File
@@ -0,0 +1,7 @@
export function differenceInDays(fromDate, toDate) {
return Math.round(Math.abs((beginningOfDay(toDate) - beginningOfDay(fromDate)) / (1000 * 60 * 60 * 24)))
}
export function beginningOfDay(date) {
return new Date(date.getFullYear(), date.getMonth(), date.getDate())
}