This commit is contained in:
Luke Vella 2024-09-28 20:14:55 +01:00
parent 8ca4b2acf8
commit 211e261c71
No known key found for this signature in database
GPG key ID: 469CAD687F0D784C
28 changed files with 519 additions and 324 deletions

View file

@ -0,0 +1,17 @@
import dayjs from "dayjs";
/**
* Get a range of dates in a human readable format
* If the start and end date are the same, return the start date
* @param start The start date
* @param end The end date
* @returns A human readable range of dates
*/
export function getRange(start: Date, end: Date) {
const startDay = dayjs(start).format("DD MMM");
const endDay = dayjs(end).format("DD MMM");
if (startDay === endDay) {
return startDay;
}
return `${startDay} - ${endDay}`;
}