Skip to content
Components

Time

A short relative time, as X shows it, with the full date on hover.

After the one-time setup, call the helper directly from ERB. No component import is needed.

<% now = Time.utc(2026, 11, 4, 12) %>
<%= lc_stack gap: :related, as: :ul, class: "m-0 list-none p-0 text-small" do %>
  <li>Posted <%= lc_time now - 30.seconds, now: now %></li>
  <li>Posted <%= lc_time now - 12.minutes, now: now %></li>
  <li>Posted <%= lc_time now - 4.hours, now: now %></li>
  <li>Posted <%= lc_time Time.utc(2026, 10, 28, 9, 30), now: now %></li>
  <li>Posted <%= lc_time Time.utc(2025, 11, 4, 18), now: now, detail: "edited" %></li>
<% end %>
<% now = Time.utc(2026, 11, 4, 12) %>
<%= lc_stack gap: :related, as: :ul, class: "m-0 list-none p-0 text-small" do %>
  <li>Posted <%= lc_time now - 30.seconds, now: now %></li>
  <li>Posted <%= lc_time now - 12.minutes, now: now %></li>
  <li>Posted <%= lc_time now - 4.hours, now: now %></li>
  <li>Posted <%= lc_time Time.utc(2026, 10, 28, 9, 30), now: now %></li>
  <li>Posted <%= lc_time Time.utc(2025, 11, 4, 18), now: now, detail: "edited" %></li>
<% end %>

Helpers render semantic HTML and include their interaction wiring. Pass native attributes through class:, data:, aria: and the usual Rails options. Blocks use captured ERB content.

lc_time

lc_time(time, now: Time.current, detail: nil, **attributes)
InputDefaultValues
timeRequired—
nowTime.current—
detailnil—
attributes{}Native HTML attributes; class:, data: and aria: merge with defaults

The examples also use lc_stack. Each is documented on its own page.

Styling and extension

Use class: to merge utilities, native attributes for application behavior, and the theming guide for the shared palette. For custom markup, the advanced class helpers expose the same styles, including glass surfaces and class merging.

API JSON · LLM reference