Client - display records on Dashboard (wip)

This commit is contained in:
Sam
2021-09-22 10:39:25 +02:00
parent 064ca22b85
commit 45438f547e
14 changed files with 735 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import {
addYears,
endOfMonth,
endOfWeek,
format,
startOfMonth,
startOfWeek,
startOfYear,
@ -60,3 +61,20 @@ export const getCalendarStartAndEnd = (
end: endOfWeek(monthEnd),
}
}
export const formatWorkoutDate = (
dateTime: Date,
dateFormat: string | null = null,
timeFormat: string | null = null
): Record<string, string> => {
if (!dateFormat) {
dateFormat = 'yyyy/MM/dd'
}
if (!timeFormat) {
timeFormat = 'HH:mm'
}
return {
workout_date: format(dateTime, dateFormat),
workout_time: format(dateTime, timeFormat),
}
}