Skip to main content

LocalTime

Function LocalTime 

Source
pub fn LocalTime(_: LocalTimeProps) -> Element
Expand description

Renders an RFC 3339 datetime as a <time> element that displays in the browser’s local timezone after hydration. During SSR, shows UTC.

Uses [js_sys::Date] on the client to convert to local time — no JavaScript eval or global scripts needed.

§Props

  • datetime — an RFC 3339 string (e.g. "2025-06-15T14:30:00Z").
  • class — optional CSS class for the <time> element.

§Example

use dioxus::prelude::*;
use dx_utils::LocalTime;

#[component]
fn UsageRow(hour_bucket: String) -> Element {
    rsx! {
        td { LocalTime { datetime: hour_bucket } }
    }
}

§Props

For details, see the props struct definition.