mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-20 22:22:16 +01:00
Add "Week" grouping option to reporting
This commit is contained in:
committed by
Gregor Vostrak
parent
97fd882878
commit
dfe3206614
@@ -236,6 +236,15 @@ export function formatWeek(date: string | null): string {
|
||||
return 'Week ' + getDayJsInstance()(date).week();
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the range covered by the week starting on the given day.
|
||||
* @param date - first day of a week, in the format of 'YYYY-MM-DD'
|
||||
*/
|
||||
export function formatWeekRange(date: string, format?: DateFormat): string {
|
||||
const end = getDayJsInstance()(date).add(6, 'day').format('YYYY-MM-DD');
|
||||
return `${formatDate(date, format)} - ${formatDate(end, format)}`;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a human readable date format.
|
||||
* @param date - date in the format of 'YYYY-MM-DD'
|
||||
|
||||
Reference in New Issue
Block a user