Skip to main content

Module date_time_edit

Module date_time_edit 

Source
Expand description

DateTimeEdit — single unified control for picking a DateTime.

Visually one widget: a single bordered frame containing a date TextInputField half, a small painted separator, a time TextInputField half, and a trailing built-in calendar button that opens a Calendar popover anchored below the wrapper. Backed by Signal<Option<DateTime>>.

┌──────────────────────────────────────┐
│ 05/02/2026   ·   14:35   │ 📅       │
└──────────────────────────────────────┘

§Why one frame?

Two adjacent DateEdit + TimeEdit (one frame each) visually read as two separate fields that happen to be next to each other. A single frame says “this is one moment in time” — same affordance the user is used to from booking sites, calendar apps, and form builders.

§Behaviour

  • Two text halves — date pattern on the left (locale-derived strftime subset), time pattern on the right (24h or 12h, with or without seconds). Each half carries its own input mask, validator, and segment-stepping (Up/Down on the focused segment).
  • Painted separator — a thin middle-dot glyph (·), no text. Visual only; AT users see the wrapper’s Role::DateTimeInput. The separator can be replaced with a custom string via separator (rendered as styled secondary text).
  • One trailing calendar button — Int UI IconButton::embedded() with the calendar glyph. Opens a single popover hosting Calendar::single bound to the date half. Picking a cell commits the date and closes the popover; the time half retains whatever the user typed.
  • One frame — focus-aware border (BorderRole::Focused while any half holds focus, otherwise Default), validation-aware border (Error for Invalid, Focused for Corrected).
  • One validation strip below the frame — composed feedback from both halves (worse of the two wins).

§Accessibility

  • Container: Role::DateTimeInput, its value the day in full and the time in the tree’s locale (“samedi 2 mai 2026 à 14:35”, “Saturday, May 2, 2026 at 2:35 PM”), with the seconds only when the field shows them. The clock is the locale’s: an explicit .time_format(...) changes what the field shows, not how the value is read.
  • Each TextInputField keeps its own AT node, a Role::TextInput named for its half (“Date”, “Time”); the wrapper’s Role::DateTimeInput provides the datetime semantics. The halves were re-roled Role::DateInput / Role::TimeInput, which the AT-SPI adapter hands a reader as a date editor, and Orca reads a date editor by its name and role alone: “Date date editor.”, never the date. An editable text field is read with its text.
  • The calendar opens on the date the date half holds, on its days, whatever an earlier opening left.
ⓘ
// Requires ctx.signal() — shown as ignore per convention.
use teksilo_widgets::date_time_edit::DateTimeEdit;
use teksilo_widgets::time_edit::SecondsMode;

let datetime = ctx.signal(None);
let _w = DateTimeEdit::new(datetime.clone())
    .seconds(SecondsMode::Hidden)
    .on_value_changed(|dt, _ctx| println!("{dt:?}"));

§Touch and pen

See DateEdit’s “Touch and pen” section.

Structs§

DateTimeEdit
Single unified datetime picker over Signal<Option<DateTime>>. See the module docs for the visual layout and behaviour.