Skip to content

Commit

Permalink
refactor: Date to string 유틸함수 사용하기
Browse files Browse the repository at this point in the history
  • Loading branch information
hamo-o committed Aug 22, 2024
1 parent b83df27 commit f460254
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/wow-ui/src/components/Picker/SingleDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { DownArrow, LeftArrow, RightArrow } from "wowds-icons";
import DateDropDown from "@/components/Picker/DateDropDown";
import { pickerButtonStyle } from "@/components/Picker/pickerButtonStyle.css";
import { usePicker } from "@/components/Picker/PickerContext";
import { changeDateToString } from "@/utils/changeDateToString";

export type DatePickerProps = Omit<PropsBase, "mode"> &
Omit<PropsSingle, "mode"> & {
Expand All @@ -36,10 +37,7 @@ const SingleDatePicker = forwardRef<HTMLDivElement, DatePickerProps>(
const selected = context?.selectedDate || propSelected!;
const onSelect = context?.setSelectedDate || propOnSelect!;

const year = selected?.getFullYear().toString();
const month =
selected && (selected.getMonth() + 1).toString().padStart(2, "0");
const day = selected?.getDate().toString().padStart(2, "0");
const { year, month, day } = changeDateToString(selected);

return (
<Flex direction="column" gap="0.75rem" ref={ref} width="19.75rem">
Expand Down

0 comments on commit f460254

Please sign in to comment.