Skip to content

Commit

Permalink
fix: 시작시간 23:30일 시, 마감시간 24:00으로 고정
Browse files Browse the repository at this point in the history
  • Loading branch information
jiohjung98 committed Jun 9, 2024
1 parent f09fd39 commit 9b2a253
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/reservation/meetingRoom/MeetingRoomIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,22 @@ const formatDisplayDate = (startDate: Date, endDate: Date): string => {

const setInitialDateTime = (): [Date, Date, string] => {
const now = new Date();
let startAt: Date;
const roundedMinutes = Math.ceil(now.getMinutes() / 30) * 30;
const startAt = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), roundedMinutes, 0);

if (now.getMinutes() > 30) {
startAt = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours() + 1, 0, 0);
let endAt: Date;
if (startAt.getHours() === 23 && startAt.getMinutes() === 30) {
endAt = new Date(startAt.getTime() + 30 * 60 * 1000);
} else {
startAt = new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), 30, 0);
endAt = new Date(startAt.getTime() + 60 * 60 * 1000);
}

const endAt = new Date(startAt.getTime() + 60 * 60 * 1000);
const currentTime = formatDisplayDate(startAt, endAt);

return [startAt, endAt, currentTime];
};


const setInitialParams = (startAt: Date, endAt: Date, branchName: string): GetMeetingRoomsParams => {
const formattedStartAt = formatDateToCustomString(startAt);
const formattedEndAt = formatDateToCustomString(endAt);
Expand Down

0 comments on commit 9b2a253

Please sign in to comment.