File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,12 @@ import { format } from "date-fns";
22import { ko } from "date-fns/locale" ;
33import { DayOfWeek } from "../types/task" ;
44import { parseDateStringToKST } from "../libs/date.ts" ;
5+ import dayjs from "dayjs" ;
6+ import timezone from "dayjs/plugin/timezone" ;
7+ import utc from "dayjs/plugin/utc" ;
8+
9+ dayjs . extend ( utc ) ;
10+ dayjs . extend ( timezone ) ;
511
612export const formatTaskTime = ( time : string ) : string => {
713 return format ( parseDateStringToKST ( time ) , "HH:mm" ) ;
@@ -51,8 +57,12 @@ export const validateImageFile = (file: File): boolean => {
5157} ;
5258
5359export const toISOStringWithTime = ( date : Date , time : string ) : string => {
54- const [ hour , minute ] = time . split ( ":" ) ;
55- const result = new Date ( date ) ;
56- result . setHours ( Number ( hour ) , Number ( minute ) , 0 , 0 ) ;
57- return result . toISOString ( ) ;
60+ const [ hour , minute ] = time . split ( ":" ) . map ( Number ) ;
61+ return dayjs ( date )
62+ . tz ( "Asia/Seoul" )
63+ . hour ( hour )
64+ . minute ( minute )
65+ . second ( 0 )
66+ . millisecond ( 0 )
67+ . format ( "YYYY-MM-DDTHH:mm" ) ;
5868} ;
You can’t perform that action at this time.
0 commit comments