On this page

Time and date time

time_picker edits a time of day as seconds since midnight. date_time_picker puts a date picker and a time picker side by side over one count of seconds.

Time Picker, picks a time of day, drawn by isolenTime Picker, picks a time of day, drawn by isolen

Both live in isolenui/kit/pickers.h and come in through isolenui/kit/kit.h. Dates are day numbers, see calendars and dates.

time_picker

time_picker(u, label, &second, spec) takes a uint32_t of seconds since midnight and shows it as parts in one field: hours, minutes, optionally seconds, and optionally an AM or PM part. The value is read modulo 86400 and written back from the parts every frame, so a value past a day comes back inside it. It returns true on the frame the value changes.

time_spec fieldDefaultMeaning
namesEnglishWhere the am and pm marks come from. Null also means English.
secondsfalseShows a seconds part.
h12falseA 12 hour clock, hours 1 to 12 plus an AM or PM part.
minute_page10How far Page Up and Page Down move the minutes and the seconds.

Keys, typing and the wheel

Every part is in the tab order and a press focuses it. The focused part claims the arrows, Home, End and the page keys.

InputDoes
Up, DownSteps the part by one and wraps, so 59 goes to 00.
Page Up, Page DownSteps hours by 6 and minutes and seconds by minute_page.
Home, EndThe lowest and highest value of the part.
Left, RightThe part before or after.
DigitsTwo digits typed within a second make one value. Focus moves on after the second digit, or after one when no second digit could fit, such as 3 in the hours.
A or PSets the AM or PM part, also the first letter of your am and pm names.
Backspace, DeleteResets the part to its lowest value.
WheelSteps the hovered part, and with Shift steps by the page. Each part keeps the wheel, so no view behind it scrolls.

date_time_picker

date_time_picker(u, label, &seconds, date, time) takes an int64_t count of seconds since 1970 01 01 on the same day numbers, so day * 86400 + second. There is no time zone, the value is whatever clock you treat it as. It splits the value, runs date_picker and time_picker with the two specs, and writes the value back only when a part changed and the day is not k_no_day. It returns true when the written value differs. Either spec may be null.

alarm.cpp
#include "isolenui/ui/ui.h"
#include "isolenui/kit/kit.h"

struct alarm_form {
    uint32_t wake = 7u * 3600u + 30u * 60u; // 07:30, seconds since midnight
    uint32_t lap = 0u;
    int64_t meeting = int64_t(ui::days_from_civil(2026, 9, 23)) * 86400 + 14 * 3600;
};

static void alarm_view(ui::ctx* u, alarm_form* a)
{
    // hours and minutes on a 24 hour clock
    if (ui::time_picker(u, "wake", &a->wake)) {
        // a part was stepped, typed or scrolled
    }

    // a 12 hour clock with seconds, page up and down move minutes by 15
    ui::time_spec ts = ui::time_defaults();
    ts.h12 = true;
    ts.seconds = true;
    ts.minute_page = 15u;
    ui::time_picker(u, "lap", &a->lap, &ts);

    // a date picker and a time picker over one count of seconds
    ui::date_time_picker(u, "meeting", &a->meeting, nullptr, &ts);
}
In kit.conf, date_time_picker needs date_picker time_picker, and the date picker needs calendar and text_box. See the component kit.

Last updated 6 October 2026