Skip to content

Commit 48bc147

Browse files
author
신용준
committed
refactor
1 parent 5221486 commit 48bc147

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

package/src/components/Controller.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import {
1111
import { addLeadingZero } from '../utils/string';
1212
import { formatLabel } from '../utils/datetime';
1313

14-
type TviewType = 'century' | 'decade' | 'year' | 'month';
14+
type TViewType = 'century' | 'decade' | 'year' | 'month';
1515

1616
interface IProps {
17-
viewType: TviewType;
18-
setViewType: (value: TviewType) => void;
17+
viewType: TViewType;
18+
setViewType: (value: TViewType) => void;
1919
viewDate: string;
2020
labelFormat: string;
2121
isMultipleCalendar: boolean;
@@ -41,7 +41,7 @@ function Controller({
4141
return formatLabel(`${year}-${month}`, labelFormat);
4242
};
4343

44-
const setLabel = (date: string, type: TviewType): string => {
44+
const setLabel = (date: string, type: TViewType): string => {
4545
if (type === 'century') {
4646
const centuryPage = setCenturyPage(date);
4747
const start = centuryPage * 100 - 99;

package/src/components/Datepicker.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import ViewMonth from './view/Month';
1919
import { addLeadingZero } from '../utils/string';
2020
import useOutsideClick from '../hooks/useOutsideClick';
2121

22-
interface Iprops {
22+
interface IProps {
2323
initValue?: Date | null;
2424
isClearButton?: boolean;
2525
isMultipleCalendar?: boolean;
@@ -35,7 +35,7 @@ function Datepicker({
3535
valueFormat = 'YYYY-MM-DD',
3636
labelFormat = 'YYYY / MM',
3737
onChange,
38-
}: Iprops) {
38+
}: IProps) {
3939
// 인수가 없을 땐 LOCAL 기준 현재 시간을 반환한다.
4040
const NEW_DATE = new Date();
4141
const [value, setValue] = useState<Date | null>(initValue);
@@ -61,8 +61,8 @@ function Datepicker({
6161
value: string | number,
6262
type: 'year' | 'month' | 'date'
6363
) => {
64-
type Tsplit = string | number;
65-
const split = viewDate.split('-') as [Tsplit, Tsplit, Tsplit];
64+
type TSplit = string | number;
65+
const split: TSplit[] = viewDate.split('-');
6666
const valueNum = Number(value);
6767

6868
if (type === 'year') {
@@ -84,7 +84,7 @@ function Datepicker({
8484
} else {
8585
split[1] = valueNum;
8686
}
87-
split[1] = addLeadingZero(split[1]);
87+
split[1] = addLeadingZero(split[1] as string);
8888
}
8989
if (type === 'date') split[2] = addLeadingZero(valueNum);
9090

0 commit comments

Comments
 (0)