mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-26 04:37:34 +02:00
uncommit
This commit is contained in:
parent
8ca4b2acf8
commit
211e261c71
28 changed files with 519 additions and 324 deletions
17
apps/web/src/utils/get-range.ts
Normal file
17
apps/web/src/utils/get-range.ts
Normal 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}`;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue