Client - display records on Dashboard (wip)
This commit is contained in:
@ -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),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user