Format Utils
日付・時刻フォーマットユーティリティ関数。null/invalid を安全に処理し、統一フォーマットで出力。
|
import { formatDate, formatDateTime, formatTime } from "@blueai/ui"Examples
formatDate
formatDate(new Date()) → 2026/03/09
formatDate("2025-06-15T14:30:00.000Z") → 2025/06/15
formatDate(null) → -
formatDate(new Date()) // → "2025/06/15"
formatDate("2025-06-15T14:30:00.000Z") // → "2025/06/15"
formatDate(null) // → "-"formatDateTime
formatDateTime(new Date()) → 2026/03/09 21:19
formatDateTime("2025-06-15T14:30:00.000Z") → 2025/06/15 14:30
formatDateTime(null) → -
formatDateTime(new Date()) // → "2025/06/15 14:30"
formatDateTime(null) // → "-"formatTime
formatTime(new Date()) → 21:19
formatTime("2025-06-15T14:30:00.000Z") → 14:30
formatTime(null) → -
formatTime(new Date()) // → "14:30"
formatTime(null) // → "-"Props
| Prop | Type | Default | Description |
|---|---|---|---|
| formatDate(date) | (string | Date | null) => string | — | YYYY/MM/DD 形式 |
| formatDateTime(date) | (string | Date | null) => string | — | YYYY/MM/DD HH:mm 形式 |
| formatTime(date) | (string | Date | null) => string | — | HH:mm 形式 |