feat(dm): add first / last message date, dm duration and overall messages
This commit is contained in:
parent
bce22b1c7f
commit
e45812534b
12 changed files with 495 additions and 65 deletions
10
src/lib/date.ts
Normal file
10
src/lib/date.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
// https://stackoverflow.com/a/15289883
|
||||
export const getDistanceBetweenDatesInDays = (a: Date, b: Date) => {
|
||||
const _MS_PER_DAY = 1000 * 60 * 60 * 24;
|
||||
|
||||
// Discard the time and time-zone information.
|
||||
const utc1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate());
|
||||
const utc2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate());
|
||||
|
||||
return Math.floor((utc2 - utc1) / _MS_PER_DAY);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue