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
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const MainCard = () => {
const token = await requestFCMToken();
if (token) {
setFcmToken(token);
localStorage.setItem('FcmToken', token);
} else {
alert('푸시 알람 설정 에러');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ export default function CardEditModal({
setIsRemindOn(checked);
};

function getKSTISOString() {
const now = new Date();
const offset = now.getTimezoneOffset() * 60000; // UTC 기준 오프셋 (분 단위)
const kst = new Date(now.getTime() - offset); // UTC → KST 보정
return kst.toISOString().slice(0, 19); // 밀리초, Z 제거
}
Comment on lines +81 to +86
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

KST 변환 로직 오류 수정 필요

MainPop.tsx와 동일한 KST 변환 로직 오류가 있습니다:

  • Line 84의 now.getTime() - offset 로직이 잘못되었습니다
  • getTimezoneOffset()은 UTC 서쪽 타임존에 대해 양수 값을 반환합니다
  • offset을 빼면 UTC로 변환되며, KST(UTC+9)가 아닙니다
  • 사용자의 현재 타임존과 무관하게 항상 KST를 생성하려면 9시간을 더해야 합니다

다음 diff를 적용하세요:

  function getKSTISOString() {
    const now = new Date();
-   const offset = now.getTimezoneOffset() * 60000; // UTC 기준 오프셋 (분 단위)
-   const kst = new Date(now.getTime() - offset); // UTC → KST 보정
+   const kst = new Date(now.getTime() + (9 * 60 * 60000)); // UTC → KST (UTC+9)
    return kst.toISOString().slice(0, 19); // 밀리초, Z 제거
  }

참고: 이 함수는 MainPop.tsx와 중복되므로, 수정 후 공통 유틸리티로 추출하는 것을 권장합니다(MainPop.tsx 리뷰 참조).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function getKSTISOString() {
const now = new Date();
const offset = now.getTimezoneOffset() * 60000; // UTC 기준 오프셋 (분 단위)
const kst = new Date(now.getTime() - offset); // UTC → KST 보정
return kst.toISOString().slice(0, 19); // 밀리초, Z 제거
}
function getKSTISOString() {
const now = new Date();
const kst = new Date(now.getTime() + (9 * 60 * 60000)); // UTC → KST (UTC+9)
return kst.toISOString().slice(0, 19); // 밀리초, Z 제거
}
🤖 Prompt for AI Agents
In apps/client/src/shared/components/cardEditModal/CardEditModal.tsx around
lines 81 to 86, the KST conversion is wrong: currently it subtracts the timezone
offset (now.getTime() - offset) which converts to UTC rather than KST. Replace
the logic to produce KST by adding 9 hours (9 * 60 * 60 * 1000) to a UTC base
(or equivalently add the offset correction plus 9 hours) and return the
resulting ISO string truncated to seconds; after fixing, consider extracting
this function into a shared util (as noted for MainPop.tsx) to avoid
duplication.


const saveData = () => {
if (!prevData?.id) {
console.error('Article ID is missing, cannot save.');
Expand All @@ -93,7 +100,7 @@ export default function CardEditModal({
categoryId:
category?.categories.find((cat) => cat.name === selectedCategory)?.id ??
-1,
now: new Date().toISOString(),
now: getKSTISOString(),
remindTime,
};

Expand Down
11 changes: 8 additions & 3 deletions apps/extension/src/pages/MainPop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ const MainPop = ({ type, savedData }: MainPopProps) => {
const handleSwitchChange = (checked: boolean) => {
setIsRemindOn(checked);
};

function getKSTISOString() {
const now = new Date();
const offset = now.getTimezoneOffset() * 60000; // UTC 기준 오프셋 (분 단위)
const kst = new Date(now.getTime() - offset); // UTC → KST 보정
return kst.toISOString().slice(0, 19); // 밀리초, Z 제거
}
Comment on lines +172 to +177
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

KST 변환 로직 오류 수정 필요

getKSTISOString() 함수의 KST 변환 로직이 잘못되었습니다:

  • Line 175의 now.getTime() - offset 로직이 잘못되었습니다
  • getTimezoneOffset()은 UTC 서쪽 타임존에 대해 양수 값을 반환합니다 (KST의 경우 +540분)
  • offset을 빼면 UTC로 변환되며, KST(UTC+9)가 아닙니다
  • 사용자의 현재 타임존과 무관하게 항상 KST를 생성하려면 9시간(32400000ms)을 더해야 합니다

다음 diff를 적용하여 올바른 KST 변환을 구현하세요:

  function getKSTISOString() {
    const now = new Date();
-   const offset = now.getTimezoneOffset() * 60000; // UTC 기준 오프셋 (분 단위)
-   const kst = new Date(now.getTime() - offset); // UTC → KST 보정
+   const kst = new Date(now.getTime() + (9 * 60 * 60000)); // UTC → KST (UTC+9)
    return kst.toISOString().slice(0, 19); // 밀리초, Z 제거
  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function getKSTISOString() {
const now = new Date();
const offset = now.getTimezoneOffset() * 60000; // UTC 기준 오프셋 (분 단위)
const kst = new Date(now.getTime() - offset); // UTC → KST 보정
return kst.toISOString().slice(0, 19); // 밀리초, Z 제거
}
function getKSTISOString() {
const now = new Date();
const kst = new Date(now.getTime() + (9 * 60 * 60000)); // UTC → KST (UTC+9)
return kst.toISOString().slice(0, 19); // 밀리초, Z 제거
}
🤖 Prompt for AI Agents
In apps/extension/src/pages/MainPop.tsx around lines 172 to 177, the KST
conversion currently subtracts the client's timezone offset which produces UTC
instead of KST; replace that logic to always add 9 hours (32400000 ms) to UTC to
produce KST regardless of the user's local timezone. Compute KST by using either
Date.now() or now.getTime() plus 32400000, create a new Date from that value,
and return its ISO string trimmed to seconds as before (slice(0,19)).

// 마지막! 저장하기 버튼 분기 (api 다르게 탐)
const handleSave = async () => {
const currentDate = date;
Expand All @@ -188,7 +193,7 @@ const MainPop = ({ type, savedData }: MainPopProps) => {
selectedCategory: selected,
date: isRemindOn ? currentDate : date,
time: isRemindOn ? currentTime : time,
createdAt: new Date().toISOString(),
createdAt: getKSTISOString(),
};

if (type === 'add') {
Expand Down Expand Up @@ -222,7 +227,7 @@ const MainPop = ({ type, savedData }: MainPopProps) => {
? parseInt(saveData.selectedCategory)
: 0,
memo: saveData.memo,
now: new Date().toISOString(),
now: getKSTISOString(),
remindTime: isRemindOn
? combineDateTime(saveData.date ?? '', saveData.time ?? '')
: null,
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
"node": ">=18"
},
"dependencies": {
"@swc/helpers": "^0.5.17",
"@tanstack/react-query": "^5.87.4",
"@types/react-router-dom": "^5.3.3",
"react-router-dom": "^7.8.2"
"react-router-dom": "^7.8.2",
Comment on lines 47 to +48
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

React Router DOM 버전과 타입 정의가 불일치합니다

react-router-dom을 ^7.8.2로 올리면서도 @types/react-router-dom ^5.3.3을 유지하면 v5 전용 선언이 강제로 적용돼 컴파일러가 잘못된 API 시그니처를 참조하거나 중복 선언 충돌이 납니다. v6 이상은 패키지 자체에 타입 정의가 포함되어 있으므로 @types/react-router-dom은 제거해 주세요.

-    "@types/react-router-dom": "^5.3.3",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"@types/react-router-dom": "^5.3.3",
"react-router-dom": "^7.8.2"
"react-router-dom": "^7.8.2",
"react-router-dom": "^7.8.2",
🤖 Prompt for AI Agents
In package.json around lines 47-48, the declared types package
@types/react-router-dom (v5.3.3) conflicts with react-router-dom v7.8.2; remove
the "@types/react-router-dom" dependency from package.json, run your package
manager install (npm/yarn/pnpm) to update node_modules and lockfile, and ensure
no leftover import/type references to @types remain in the project or tsconfig;
if CI includes a cached lockfile, update it so the removed dependency is
reflected.

"yaml": "^2.4.2"
}
}
Loading
Loading