Skip to content

Commit

Permalink
Merge pull request #347 from KakaoFunding/feat/346
Browse files Browse the repository at this point in the history
[feat]: 주문내역 등록 날짜 추가(#346)
  • Loading branch information
devkyoung2 authored Jun 10, 2024
2 parents 2af329a + f563044 commit 3fb6ee7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/layouts/MyPage/OrderHistory/OrderItem/index.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
@import 'styles/mixins.module';

.txt_date {
@include font(15px, 400);

margin-bottom: 10px;

.num_date {
@include font(15px, 700);

margin-left: 5px;
}
}

.wrapper_order {
margin-bottom: 30px;
border: 2px solid #ededed;
Expand Down
9 changes: 8 additions & 1 deletion src/layouts/MyPage/OrderHistory/OrderItem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Link } from 'react-router-dom';

import { formatNumberWithComma } from 'utils/format';
import { formatNumberWithComma, formatDateAndTime } from 'utils/format';

import { OrderItemType } from 'types/order';

Expand All @@ -11,6 +11,13 @@ type OrderItemProps = { item: OrderItemType };
const OrderItem = ({ item }: OrderItemProps) => {
return (
<Link to={`/product/${item.product.productId}`}>
<p className={styles.txt_date}>
등록한 날짜
<span className={styles.num_data}>
{formatDateAndTime(item.orderDate)}
</span>
</p>

<div className={styles.wrapper_order}>
<div className={styles.section_receiver}>
<span className={styles.ico_receiver} />
Expand Down
5 changes: 3 additions & 2 deletions src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ export const formatDate = (date: Date) => {
export const formatDateAndTime = (dateTime: string) => {
const [date, time] = dateTime.split('T');

const formattedDate = date.split('-').join('.');
const formattedDate = date.replaceAll('-', '.');
const formattedTime = time.slice(0, 8);

return `${formattedDate} ${time}`;
return `${formattedDate} ${formattedTime}`;
};

export const formatBirthDate = (birthDate: string) => {
Expand Down

0 comments on commit 3fb6ee7

Please sign in to comment.