投稿検索ページ(#206) (#274)
#206 エラー修正 #206 updated_at の並び順修正 Merge remote-tracking branch 'origin/main' into feature/206 Merge branch 'main' into feature/206 Merge branch 'main' into feature/206 Merge branch 'main' into feature/206 #206 #206 #206 #206 #206 #206 タグ補完追加 #206 #206 #206 #206 #206 Merge remote-tracking branch 'origin/main' into feature/206 #206 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #274
This commit was merged in pull request #274.
This commit is contained in:
@@ -4,4 +4,23 @@ import { twMerge } from 'tailwind-merge'
|
||||
import type { ClassValue } from 'clsx'
|
||||
|
||||
|
||||
export const toDate = (d: string | Date): Date => typeof d === 'string' ? new Date (d) : d
|
||||
|
||||
|
||||
export const cn = (...inputs: ClassValue[]) => twMerge (clsx (...inputs))
|
||||
|
||||
|
||||
export const dateString = (d: string | Date): string =>
|
||||
toDate (d).toLocaleString ('ja-JP-u-ca-japanese')
|
||||
|
||||
|
||||
// TODO: 表示形式きしょすぎるので何とかする
|
||||
export const originalCreatedAtString = (
|
||||
f: string | Date | null,
|
||||
b: string | Date | null,
|
||||
): string =>
|
||||
([f ? `${ dateString (f) } 以降` : '',
|
||||
b ? `${ dateString (b) } より前` : '']
|
||||
.filter (Boolean)
|
||||
.join (' '))
|
||||
|| '不明'
|
||||
|
||||
Reference in New Issue
Block a user