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.


In the galleryTime Pickertime_pickerDate Time Pickerdate_time_picker
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 field | Default | Meaning |
|---|---|---|
names | English | Where the am and pm marks come from. Null also means English. |
seconds | false | Shows a seconds part. |
h12 | false | A 12 hour clock, hours 1 to 12 plus an AM or PM part. |
minute_page | 10 | How 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.
| Input | Does |
|---|---|
| Up, Down | Steps the part by one and wraps, so 59 goes to 00. |
| Page Up, Page Down | Steps hours by 6 and minutes and seconds by minute_page. |
| Home, End | The lowest and highest value of the part. |
| Left, Right | The part before or after. |
| Digits | Two 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 P | Sets the AM or PM part, also the first letter of your am and pm names. |
| Backspace, Delete | Resets the part to its lowest value. |
| Wheel | Steps 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.
#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);
}kit.conf, date_time_picker needs date_picker time_picker, and the date picker needs calendar and text_box. See the component kit.