Skip to content

Commit

Permalink
refactor: format~ 으로 함수 네이밍 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hamo-o committed Aug 26, 2024
1 parent 1e840cc commit fd61907
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/wow-ui/src/components/Picker/DateDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const DateDropDown = ({
selectedValue,
onClick,
}: DateDropDownProps) => {
const findRenderString = () => {
const formatSelectedValue = () => {
if (!selectedValue) return placeholder;
if (mode === "range" && selectedValue.start) return selectedValue.start;
if (mode === "single") return selectedValue;
Expand All @@ -48,7 +48,7 @@ const DateDropDown = ({
type: selectedValue ? "selected" : "default",
})}
>
{findRenderString()}
{formatSelectedValue()}
</div>
{mode === "range" && (
<div
Expand Down
10 changes: 5 additions & 5 deletions packages/wow-ui/src/components/Picker/TimePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ const TimePicker = forwardRef<HTMLDivElement, TimePickerProps>(
});
};

const changeNumberToStirng = (number: number) => {
const formatNumberToStirng = (number: number) => {
return number.toString().padStart(2, "0");
};

const changeTimeToString = (time: Time) => {
const formatTimeToString = (time: Time) => {
const transformedHour = () => {
if (time.hour === 0) return 12;
if (time.hour > 12) return time.hour - 12;
return time.hour;
};

const hour = changeNumberToStirng(transformedHour());
const minute = changeNumberToStirng(time.minute);
const hour = formatNumberToStirng(transformedHour());
const minute = formatNumberToStirng(time.minute);

return { hour, minute };
};

const strTime = changeTimeToString(selectedTime);
const strTime = formatTimeToString(selectedTime);

return (
<Flex direction="column" gap="0.75rem">
Expand Down

0 comments on commit fd61907

Please sign in to comment.