
✅ Luxon이란?
JavaScript로 날짜를 다루는 라이브러리.
npm install --save luxon
https://moment.github.io/luxon/#/install
luxon - Immutable date wrapper
moment.github.io
TypeScript
npm install --save-dev @types/luxon
TypeScript를 사용하면 이것도 설치해야 한다.
✅ 기본값 세팅
export function Layout({ children }: { children: React.ReactNode }) {
Settings.defaultLocale = "ko";
Settings.defaultZone = "Asia/Seoul";
return (
<html lang="en" className="dark">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<main className="px-20">{children}</main>
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}
이렇게 설정해주면 밑과 같이 매번 세팅을 해줄 필요가 없어진다.
const date = DateTime.fromObject(loaderData)
.setZone("Asia/Seoul")
.setLocale("Asia/Seoul");
'📂 라이브러리' 카테고리의 다른 글
| 라이브러리 - Simple Icons (0) | 2026.05.15 |
|---|---|
| 라이브러리 - React Router v7 (0) | 2026.05.11 |
| 라이브러리 - Lucide React (0) | 2026.04.29 |
| 라이브러리 - Shadcn/ui (0) | 2026.04.27 |
| 라이브러리 - Jupyter (0) | 2026.04.17 |