# useDateFormat URL: /docs/web/hooks/use-date-format Provider-agnostic date / datetime / time formatting context for Docyrus UI components. Wired automatically by DocyrusTenantProvider, but works with any date library. ## Installation ```bash pnpm dlx @docyrus/cli add @docyrus/hooks-use-date-format ``` The module exports `useDateFormat()` (hook) and ` ); } ``` The same pattern works with `dayjs`, `next-intl`, or any other library. ## API Reference ### `useDateFormat()` Returns `DateFormatContextValue`. | Field | Type | Description | |-------|------|-------------| | `formatDate` | `(value: unknown) => string` | Date-only output. | | `formatDateTime` | `(value: unknown) => string` | Date + time output. | | `formatTime` | `(value: unknown) => string` | Time-only output. | ### `` | Prop | Type | Description | |------|------|-------------| | `formatDate` | `DateFormatFn` | Required. Backs `formatDate` inside the tree. | | `formatDateTime` | `DateFormatFn` | Required. Backs `formatDateTime` inside the tree. | | `formatTime` | `DateFormatFn` | Required. Backs `formatTime` inside the tree. | | `children` | `ReactNode` | Tree to wrap. | ### `isDefaultDateFormatContext(ctx)` Returns `true` when the value returned by `useDateFormat()` is the built-in no-provider sentinel (raw string renderer) rather than a real provider. Internal hooks use this to avoid shadowing a cell's own fallback when no provider is mounted. Most apps don't need to call it directly. ## Type Exports | Type | Description | |------|-------------| | `DateFormatFn` | Signature of each formatter function (`(value: unknown) => string`). | | `DateFormatContextValue` | Shape returned by `useDateFormat()`. |