Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/app/[activityId]/_components/MobileReserveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import activitiesApi from '@/api/activitiesApi';
import { useActivityDetail } from '@/app/[activityId]/_hooks/queries/useActivityDetail';
import { useAvailableSchedule } from '@/app/[activityId]/_hooks/queries/useAvailableSchedule';
import {
getKSTDateString,
getMonthNameEnglish,
isSameMonth,
} from '@/app/[activityId]/_utils/activityDetailDates';
Expand Down Expand Up @@ -110,7 +111,6 @@ export default function MobileReserveModal({
>
{step === 1 && (
<>
{/* λ‚ μ§œ 선택 */}
<div className='txt-18_B'>λ‚ μ§œ</div>
<div className='my-20 flex justify-between'>
<p className='txt-16_B'>{getMonthNameEnglish(currentDate)}</p>
Expand Down Expand Up @@ -144,7 +144,6 @@ export default function MobileReserveModal({
</div>
</div>

{/* μΊ˜λ¦°λ” */}
<div className='grid grid-cols-7 gap-10 text-center'>
{['S', 'M', 'T', 'W', 'T', 'F', 'S'].map((day, i) => (
<div key={i} className='txt-16_M font-semibold'>
Expand All @@ -153,7 +152,7 @@ export default function MobileReserveModal({
))}
{dates.map((date) => {
const isCurrent = isSameMonth(currentDate, date);
const formatted = date.toISOString().split('T')[0];
const formatted = getKSTDateString(date);
const isAvailable = schedules.some((s) => s.date === formatted);
const isSelected = selectedDate === formatted;

Expand All @@ -179,7 +178,6 @@ export default function MobileReserveModal({
})}
</div>

{/* μ‹œκ°„ 선택 */}
<div className='mt-24'>
<p className='txt-16_B mb-12 text-gray-950'>μ˜ˆμ•½ κ°€λŠ₯ν•œ μ‹œκ°„</p>
{selectedDate ? (
Expand Down Expand Up @@ -222,7 +220,6 @@ export default function MobileReserveModal({

{step === 2 && (
<>
{/* 인원 선택 */}
<div className='flex flex-row gap-4'>
<button onClick={() => setStep(1)}>
<Icon className='h-24 w-24' icon='ArrowLeft' />
Expand Down Expand Up @@ -263,7 +260,6 @@ export default function MobileReserveModal({

{step === 3 && (
<>
{/* 가격 및 μ‹œκ°„ μš”μ•½ */}
{price !== null && (
<div className='mt-24'>
<div className='mb-12 flex justify-between'>
Expand Down
5 changes: 3 additions & 2 deletions src/app/[activityId]/_components/ReserveCalender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ApiError } from '@/api/types/auth';
import { useActivityDetail } from '@/app/[activityId]/_hooks/queries/useActivityDetail';
import { useAvailableSchedule } from '@/app/[activityId]/_hooks/queries/useAvailableSchedule';
import {
getKSTDateString,
getMonthNameEnglish,
isSameMonth,
} from '@/app/[activityId]/_utils/activityDetailDates';
Expand Down Expand Up @@ -52,7 +53,7 @@ export default function ReserveCalender({
: [];

const handleDateClick = (date: Date) => {
const formatted = date.toISOString().split('T')[0];
const formatted = getKSTDateString(date);
const isAvailable = schedules.some((s) => s.date === formatted);
if (!isAvailable) return;
setSelectedDate(formatted);
Expand Down Expand Up @@ -146,7 +147,7 @@ export default function ReserveCalender({
))}
{dates.map((date) => {
const isCurrentMonth = isSameMonth(currentDate, date);
const formatted = date.toISOString().split('T')[0];
const formatted = getKSTDateString(date);
const isAvailable = schedules.some((s) => s.date === formatted);
return (
<div
Expand Down
3 changes: 2 additions & 1 deletion src/app/[activityId]/_components/TabletReserveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import activitiesApi from '@/api/activitiesApi';
import { useActivityDetail } from '@/app/[activityId]/_hooks/queries/useActivityDetail';
import { useAvailableSchedule } from '@/app/[activityId]/_hooks/queries/useAvailableSchedule';
import {
getKSTDateString,
getMonthNameEnglish,
isSameMonth,
} from '@/app/[activityId]/_utils/activityDetailDates';
Expand Down Expand Up @@ -144,7 +145,7 @@ export default function TabletReserveModal({
))}
{dates.map((date) => {
const isCurrent = isSameMonth(currentDate, date);
const formatted = date.toISOString().split('T')[0];
const formatted = getKSTDateString(date);
const isAvailable = schedules.some(
(s) => s.date === formatted,
);
Expand Down
6 changes: 6 additions & 0 deletions src/app/[activityId]/_utils/activityDetailDates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ export const getMonthNameEnglish = (date: Date): string =>
export const isSameMonth = (base: Date, target: Date) =>
base.getFullYear() === target.getFullYear() &&
base.getMonth() === target.getMonth();

export const getKSTDateString = (date: Date) => {
const offset = 9 * 60 * 60 * 1000;
const kstDate = new Date(date.getTime() + offset);
return kstDate.toISOString().split('T')[0];
};