-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug Fix: #9 - realtimePosts는 SWR의 revalidateOnFocus가 적용되지 않으므로fromNow…
… 값을 1분마다 다시 계산
- Loading branch information
Showing
6 changed files
with
51 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
import dayjs from "dayjs"; | ||
import relativeTime from "dayjs/plugin/relativeTime"; | ||
import updateLocale from "dayjs/plugin/updateLocale"; | ||
import "dayjs/locale/ko"; | ||
import dayjs from 'dayjs'; | ||
import 'dayjs/locale/ko'; | ||
import relativeTime from 'dayjs/plugin/relativeTime'; | ||
import updateLocale from 'dayjs/plugin/updateLocale'; | ||
|
||
dayjs.extend(relativeTime); | ||
dayjs.extend(updateLocale); | ||
|
||
dayjs.updateLocale("ko", { | ||
relativeTime: { | ||
future: "%s 후", | ||
past: "%s 전", | ||
s: "몇 초", | ||
m: "1분", | ||
mm: "%d분", | ||
h: "한 시간", | ||
hh: "%d시간", | ||
d: "하루", | ||
dd: "%d일", | ||
M: "한 달", | ||
MM: "%d개월", | ||
y: "일 년", | ||
yy: "%d년", | ||
}, | ||
dayjs.updateLocale('ko', { | ||
relativeTime: { | ||
future: '%s 후', | ||
past: '%s 전', | ||
s: '몇 초', | ||
m: '1분', | ||
mm: '%d분', | ||
h: '한 시간', | ||
hh: '%d시간', | ||
d: '하루', | ||
dd: '%d일', | ||
M: '한 달', | ||
MM: '%d개월', | ||
y: '일 년', | ||
yy: '%d년', | ||
}, | ||
}); | ||
|
||
dayjs.locale("ko"); | ||
dayjs.locale('ko'); | ||
|
||
const fromNow = (date: string): string => { | ||
return dayjs(date).fromNow(); | ||
const getFromNow = (date: string): string => { | ||
return dayjs(date).fromNow(); | ||
}; | ||
|
||
const getKoreanFormat = (date: string): string => { | ||
return dayjs(date).format("YYYY년 M월 D일 HH:mm"); | ||
return dayjs(date).format('YYYY년 M월 D일 HH:mm'); | ||
}; | ||
|
||
export { fromNow, getKoreanFormat }; | ||
export { getFromNow, getKoreanFormat }; |