-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show scheduling rules on child.
- Loading branch information
Showing
2 changed files
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { type ChildScheduleListVMScheduleRule } from "@api/models/childScheduleListVMScheduleRule"; | ||
import dayjs from "dayjs"; | ||
|
||
export const scheduleRulesFormatter = (scheduleRules: ChildScheduleListVMScheduleRule[]): string => { | ||
|
||
const monday = dayjs().startOf("week").add(1, "day"); // Ensure the week starts on Monday | ||
|
||
return scheduleRules | ||
.map((rule) => { | ||
const dayName = monday.add(rule.day!, "day").format("dd"); // Get the localized day name | ||
return `${dayName}: ${rule.timeSlotId}`; | ||
}) | ||
.join("\n"); // Join all formatted rules into a single string with line breaks | ||
}; |