forge
Explore
Log in

Don't you dare go Hollow

Clock time: two boxes, hour and minute, inside the deadline popover

Browse files at this commit

88fee1e27bff791f53a06da1c12934c511bf6b46Ahmet Kaan GümüşParent: 264fcca
The searchable dropdown carried 288 rows for what is two small numbers.
It is now a datepick-time row in the same panel: an hour box, a colon,
a minute box — numeric, maxlength 2, prefilled from the task's clock in
the viewer's zone, committed by a day press like the rest of the form.
ClockHour/ClockMinute name the boxes for a screen reader; Clear blanks
both. compose_clock keeps moment_field and parse_hhmm as the one
validators (absent pair keeps, empty pair clears, a lone box refuses).

run.sh bundles assets through the topcoat CLI before starting the
server: a plain cargo build leaves the previous content-hash bundle in
target/<profile>/assets, and every check would pass against the last
build's css.
crates/izlek-web/src/board.rsmodified+12 -4
@@ -81,7 +81,8 @@ async fn create_task_shared(
81 column_id: &str,81 column_id: &str,
82 description: &str,82 description: &str,
83 deadline_raw: &str,83 deadline_raw: &str,
84- time_raw: &str,84+ clock_hour: Option<&str>,
85+ clock_minute: Option<&str>,
85 ) -> Result<Option<Refusal>> {86 ) -> Result<Option<Refusal>> {
86 87
87 let user = match require_writer(cx).await {88 let user = match require_writer(cx).await {
@@ -93,10 +94,14 @@ async fn create_task_shared(
93 return Ok(Some(Refusal::EmptyTitle));94 return Ok(Some(Refusal::EmptyTitle));
94 }95 }
95 let zone = izlek_core::detail::parse_zone(&user.timezone);96 let zone = izlek_core::detail::parse_zone(&user.timezone);
97+ let time = match crate::detail::combine_clock(clock_hour, clock_minute) {
98+ Ok(time) => time,
99+ Err(refusal) => return Ok(Some(refusal)),
100+ };
96 let (deadline, clock_at) = match crate::detail::moment_field(101 let (deadline, clock_at) = match crate::detail::moment_field(
97 Some(deadline_raw),102 Some(deadline_raw),
98 (None, None),103 (None, None),
99- Some(time_raw),104+ time.as_deref(),
100 zone,105 zone,
101 ) {106 ) {
102 Ok(pair) => pair,107 Ok(pair) => pair,
@@ -161,7 +166,9 @@ struct CreateTaskForm {
161 #[serde(default)]166 #[serde(default)]
162 deadline: String,167 deadline: String,
163 #[serde(default)]168 #[serde(default)]
164- clock_time: String,169+ clock_hour: Option<String>,
170+ #[serde(default)]
171+ clock_minute: Option<String>,
165 }172 }
166 173
167 /// A browser without script's way onto the board: a real form post, same174 /// A browser without script's way onto the board: a real form post, same
@@ -174,7 +181,8 @@ async fn create_task(cx: &Cx, Form(input): Form<CreateTaskForm>) -> Redirect {
174 &input.column_id,181 &input.column_id,
175 &input.description,182 &input.description,
176 &input.deadline,183 &input.deadline,
177- &input.clock_time,184+ input.clock_hour.as_deref(),
185+ input.clock_minute.as_deref(),
178 )186 )
179 .await?187 .await?
180 {188 {
crates/izlek-web/src/detail.rsmodified+42 -35
@@ -236,7 +236,9 @@ struct SaveTaskForm {
236 #[serde(default)]236 #[serde(default)]
237 deadline: Option<String>,237 deadline: Option<String>,
238 #[serde(default)]238 #[serde(default)]
239- clock_time: Option<String>,239+ clock_hour: Option<String>,
240+ #[serde(default)]
241+ clock_minute: Option<String>,
240 }242 }
241 243
242 #[derive(Deserialize)]244 #[derive(Deserialize)]
@@ -542,11 +544,23 @@ fn parse_hhmm(raw: &str) -> Option<(u8, u8)> {
542 (hour <= 23 && minute <= 59).then_some((hour, minute))544 (hour <= 23 && minute <= 59).then_some((hour, minute))
543 }545 }
544 546
545-/// The moment field's menu words: every five minutes of the day,547+/// The posted hour and minute words as one `HH:MM` for [`moment_field`],
546-/// zero-padded, the value and the label the same word — the logs filters'548+/// which stays the one validator of the shape. Both absent: the form said
547-/// shape, at 288 options a `data-search` box is what makes it usable.549+/// nothing about the time. Both empty: the popover's Clear, clearing the
548-fn clock_steps() -> impl Iterator<Item = String> {550+/// clock. Both set: the moment, however the hands typed it. One without
549- (0..24 * 12).map(|step| format!("{:02}:{:02}", step / 12, (step % 12) * 5))551+/// the other is a form gone wrong, not something to guess past.
552+pub(crate) fn combine_clock(
553+ hour: Option<&str>,
554+ minute: Option<&str>,
555+) -> std::result::Result<Option<String>, Refusal> {
556+ match (hour, minute) {
557+ (None, None) => Ok(None),
558+ (Some(""), Some("")) => Ok(Some(String::new())),
559+ (Some(hour), Some(minute)) => {
560+ Ok(Some(format!("{}:{}", hour.trim(), minute.trim())))
561+ }
562+ _ => Err(Refusal::BadClock),
563+ }
550 }564 }
551 565
552 /// Saves the title, the description and the moment field — the deadline day566 /// Saves the title, the description and the moment field — the deadline day
@@ -576,10 +590,14 @@ async fn save_task(cx: &Cx, Form(input): Form<SaveTaskForm>) -> Redirect {
576 None => facts.description.clone(),590 None => facts.description.clone(),
577 };591 };
578 let zone = parse_zone(&user.timezone);592 let zone = parse_zone(&user.timezone);
593+ let time = match combine_clock(input.clock_hour.as_deref(), input.clock_minute.as_deref()) {
594+ Ok(time) => time,
595+ Err(refusal) => return redirect(cx, Some(refusal)),
596+ };
579 let (deadline, clock_at) = match moment_field(597 let (deadline, clock_at) = match moment_field(
580 input.deadline.as_deref(),598 input.deadline.as_deref(),
581 (facts.row.deadline, facts.row.clock_at),599 (facts.row.deadline, facts.row.clock_at),
582- input.clock_time.as_deref(),600+ time.as_deref(),
583 zone,601 zone,
584 ) {602 ) {
585 Ok(pair) => pair,603 Ok(pair) => pair,
@@ -1274,7 +1292,7 @@ async fn deadline_control(
1274 may_write: bool,1292 may_write: bool,
1275 lang: Lang,1293 lang: Lang,
1276 ) -> Result {1294 ) -> Result {
1277- use time::macros::format_description;1295+
1278 1296
1279 let overdue = task.is_overdue(today);1297 let overdue = task.is_overdue(today);
1280 let local = task.clock_at.map(|at| at.to_offset(zone));1298 let local = task.clock_at.map(|at| at.to_offset(zone));
@@ -1312,17 +1330,12 @@ async fn deadline_control(
1312 }1330 }
1313 let toggle = format!("deadline-{}", task.id);1331 let toggle = format!("deadline-{}", task.id);
1314 let input_value = task.deadline_input();1332 let input_value = task.deadline_input();
1315- let time_selected = local1333+ let hour_value = local
1316- .map(|at| at.format(&format_description!("[hour]:[minute]")))1334+ .map(|at| format!("{:02}", at.hour()))
1317- .transpose()1335+ .unwrap_or_default();
1336+ let minute_value = local
1337+ .map(|at| format!("{:02}", at.minute()))
1318 .unwrap_or_default();1338 .unwrap_or_default();
1319- let steps: Vec<String> = clock_steps().collect();
1320- // A clock off the five-minute grid is still the truth that is stored:
1321- // its exact option is appended, never rounded onto a step.
1322- let time_exact = time_selected
1323- .as_ref()
1324- .filter(|value| !steps.iter().any(|step| step == *value))
1325- .cloned();
1326 let change_aria = t(lang, Key::ChangeTheDeadline);1339 let change_aria = t(lang, Key::ChangeTheDeadline);
1327 let no_deadline = t(lang, Key::NoDeadline);1340 let no_deadline = t(lang, Key::NoDeadline);
1328 view! {1341 view! {
@@ -1338,15 +1351,11 @@ async fn deadline_control(
1338 <form class="pop-form" method="post" action="/api/save_task">1351 <form class="pop-form" method="post" action="/api/save_task">
1339 <input type="hidden" name="task_id" value=(task.id.clone())>1352 <input type="hidden" name="task_id" value=(task.id.clone())>
1340 (datepicker_grid(cx, "deadline", &input_value, true, lang).await?)1353 (datepicker_grid(cx, "deadline", &input_value, true, lang).await?)
1341- <select class="field-input" name="clock_time" aria-label=(t(lang, Key::ClockTime)) data-autosubmit="" data-search="">1354+ <div class="datepick-time">
1342- <option value="">("--")</option>1355+ <input class="field-input" name="clock_hour" type="text" inputmode="numeric" maxlength="2" placeholder="HH" aria-label=(t(lang, Key::ClockHour)) value=(hour_value)>
1343- for time in &steps {1356+ <span class="datepick-colon">(":")</span>
1344- <option value=(time) selected=(time_selected.as_deref() == Some(time.as_str()))>(time)</option>1357+ <input class="field-input" name="clock_minute" type="text" inputmode="numeric" maxlength="2" placeholder="MM" aria-label=(t(lang, Key::ClockMinute)) value=(minute_value)>
1345- }1358+ </div>
1346- if let Some(value) = &time_exact {
1347- <option value=(value) selected=(true)>(value)</option>
1348- }
1349- </select>
1350 </form>1359 </form>
1351 (refused(cx, "save_task", lang).await?)1360 (refused(cx, "save_task", lang).await?)
1352 </div>1361 </div>
@@ -1432,7 +1441,7 @@ pub(crate) async fn datepicker_script(cx: &Cx, lang: Lang) -> Result {
1432 var input = panel.querySelector('.datepick-input');\1441 var input = panel.querySelector('.datepick-input');\
1433 if (!input) {{ return; }}\1442 if (!input) {{ return; }}\
1434 input.value = ymd ? (ymd.y + '-' + pad(ymd.m) + '-' + pad(ymd.d)) : '';\1443 input.value = ymd ? (ymd.y + '-' + pad(ymd.m) + '-' + pad(ymd.d)) : '';\
1435- if (!ymd) {{ var clock = panel.querySelector('[name=clock_time]'); if (clock) {{ clock.value = ''; }} }}\1444+ if (!ymd) {{ var hh = panel.querySelector('[name=clock_hour]'); if (hh) {{ hh.value = ''; }} var mm = panel.querySelector('[name=clock_minute]'); if (mm) {{ mm.value = ''; }} }}\
1436 var pop = panel.closest('.datepick-pop');\1445 var pop = panel.closest('.datepick-pop');\
1437 var label = pop.querySelector('.datepick-label');\1446 var label = pop.querySelector('.datepick-label');\
1438 if (label) {{ label.textContent = ymd ? (MONTHS[ymd.m - 1].slice(0, 3) + ' ' + pad(ymd.d)) : label.dataset.empty; }}\1447 if (label) {{ label.textContent = ymd ? (MONTHS[ymd.m - 1].slice(0, 3) + ' ' + pad(ymd.d)) : label.dataset.empty; }}\
@@ -2570,7 +2579,6 @@ async fn sheet_view(
2570 /// as [`task_modal`], with a form posting straight to `/api/create_task`.2579 /// as [`task_modal`], with a form posting straight to `/api/create_task`.
2571 /// Wired off the board top bar's "New task" button as `/?new=1`.2580 /// Wired off the board top bar's "New task" button as `/?new=1`.
2572 pub async fn new_task_modal(cx: &Cx, columns: &[(String, String)], lang: Lang) -> Result {2581 pub async fn new_task_modal(cx: &Cx, columns: &[(String, String)], lang: Lang) -> Result {
2573- let steps: Vec<String> = clock_steps().collect();
2574 view! {2582 view! {
2575 cx =>2583 cx =>
2576 <div class="modal-scrim">2584 <div class="modal-scrim">
@@ -2607,12 +2615,11 @@ pub async fn new_task_modal(cx: &Cx, columns: &[(String, String)], lang: Lang) -
2607 </label>2615 </label>
2608 <div class="edit-form pop-panel datepick-panel">2616 <div class="edit-form pop-panel datepick-panel">
2609 (datepicker_grid(cx, "deadline", "", false, lang).await?)2617 (datepicker_grid(cx, "deadline", "", false, lang).await?)
2610- <select class="field-input" name="clock_time" aria-label=(t(lang, Key::ClockTime)) data-search="">2618+ <div class="datepick-time">
2611- <option value="">("--")</option>2619+ <input class="field-input" name="clock_hour" type="text" inputmode="numeric" maxlength="2" placeholder="HH" aria-label=(t(lang, Key::ClockHour))>
2612- for time in &steps {2620+ <span class="datepick-colon">(":")</span>
2613- <option value=(time)>(time)</option>2621+ <input class="field-input" name="clock_minute" type="text" inputmode="numeric" maxlength="2" placeholder="MM" aria-label=(t(lang, Key::ClockMinute))>
2614- }2622+ </div>
2615- </select>
2616 </div>2623 </div>
2617 </div>2624 </div>
2618 </div>2625 </div>
crates/izlek-web/src/i18n.rsmodified+6 -3
@@ -358,7 +358,8 @@ pub enum Key {
358 InvitedByLabel,358 InvitedByLabel,
359 MailBatchLabel,359 MailBatchLabel,
360 ReminderMinutesLabel,360 ReminderMinutesLabel,
361- ClockTime,361+ ClockHour,
362+ ClockMinute,
362 }363 }
363 364
364 /// The lone templated phrase — a name in the middle reads worse as two365 /// The lone templated phrase — a name in the middle reads worse as two
@@ -1019,8 +1020,10 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
1019 (MailBatchLabel, Tr) => "Posta gecikmesi (dakika)",1020 (MailBatchLabel, Tr) => "Posta gecikmesi (dakika)",
1020 (ReminderMinutesLabel, En) => "Reminder (minutes)",1021 (ReminderMinutesLabel, En) => "Reminder (minutes)",
1021 (ReminderMinutesLabel, Tr) => "Hatırlatma (dakika)",1022 (ReminderMinutesLabel, Tr) => "Hatırlatma (dakika)",
1022- (ClockTime, En) => "Time",1023+ (ClockHour, En) => "Hour",
1023- (ClockTime, Tr) => "Saat",1024+ (ClockHour, Tr) => "Saat",
1025+ (ClockMinute, En) => "Minute",
1026+ (ClockMinute, Tr) => "Dakika",
1024 }1027 }
1025 }1028 }
1026 1029
crates/izlek-web/tests/browser/moment.mjsmodified+6 -29
@@ -99,34 +99,11 @@ const chipLabel = `${MONTHS[picked.month - 1]} ${pad(picked.day)} · 16:20`;
99 const fieldLabel = `${MONTHS[picked.month - 1]} ${pad(picked.day)} 16:20`;99 const fieldLabel = `${MONTHS[picked.month - 1]} ${pad(picked.day)} 16:20`;
100 100
101 101
102-// The time rides the same panel as a house dropdown: the select is102+// The time rides the same panel as two two-digit boxes — hour, colon,
103-// enhanced into a trigger and a panel, so a hand on it clicks the trigger,103+// minute — typed before the day press, so the one form post carries both.
104-// types to filter, and presses the row — which also exercises the search104+// Neither box autosubmits: a lone box is half a value.
105-// box the data-search attribute buys. The dd pick writes the select's105+await page.fill('.modal-new-task input[name="clock_hour"]', '16');
106-// value; the modal select carries no data-autosubmit, so nothing posts106+await page.fill('.modal-new-task input[name="clock_minute"]', '20');
107-// until the form's own button.
108-await page.click(
109- '.modal-new-task select[name="clock_time"] >> xpath=preceding-sibling::button[1]',
110-);
111-const menu = page.locator('.dd-panel.dd-open');
112-await menu.locator('.dd-search').fill('16:');
113-const filtered = await menu.locator('.dd-search').evaluate((el) => {
114- const panel = el.closest('.dd-panel');
115- const row = panel.querySelector('.dd-option[data-value="16:20"]');
116- return {
117- search: el.value,
118- rows: panel.querySelectorAll('.dd-option').length,
119- hidden: panel.querySelectorAll('.dd-option-hidden').length,
120- rowOn: !!row && !row.classList.contains('dd-option-hidden'),
121- };
122-});
123-if (filtered.search !== '16:') failures.push(`the search box read '${filtered.search}'`);
124-if (filtered.rows !== 289) failures.push(`the menu holds ${filtered.rows} rows, not 289`);
125-if (!filtered.rowOn) failures.push("typing '16:' did not leave the 16:20 row on the menu");
126-// Press the row through its own handler. The panel's scroll-close race can
127-// make a point-and-click flake here; the handler is the house code either
128-// way, and the value it writes is asserted below.
129-await menu.locator('.dd-option[data-value="16:20"]').evaluate((el) => el.click());
130 107
131 // Then the day press, whose pick() writes the hidden input in place — in108 // Then the day press, whose pick() writes the hidden input in place — in
132 // the modal nothing autosubmits, so the value is read in the same tick as109 // the modal nothing autosubmits, so the value is read in the same tick as
@@ -145,7 +122,7 @@ if (!/^\d{4}-\d{2}-\d{2}$/.test(written.after)) {
145 failures.push(`the day pick never wrote the hidden input: '${written.after}'`);122 failures.push(`the day pick never wrote the hidden input: '${written.after}'`);
146 }123 }
147 const atSubmit = await page.evaluate(() => ({124 const atSubmit = await page.evaluate(() => ({
148- time: document.querySelector('.modal-new-task select[name="clock_time"]')?.value,125+ time: `${document.querySelector('.modal-new-task input[name="clock_hour"]')?.value}:${document.querySelector('.modal-new-task input[name="clock_minute"]')?.value}`,
149 day: document.querySelector('.modal-new-task .datepick-input')?.value,126 day: document.querySelector('.modal-new-task .datepick-input')?.value,
150 }));127 }));
151 if (atSubmit.time !== '16:20') failures.push(`the time box read '${atSubmit.time}' at submit`);128 if (atSubmit.time !== '16:20') failures.push(`the time box read '${atSubmit.time}' at submit`);
crates/izlek-web/tests/browser/run.shmodified+5 -1
@@ -39,7 +39,11 @@ if [[ ! -f $IZLEK_PLAYWRIGHT ]]; then
39 (cd "$home" && npx playwright install --only-shell chromium)39 (cd "$home" && npx playwright install --only-shell chromium)
40 fi40 fi
41 41
42-cargo build --manifest-path "$repo/Cargo.toml" -p izlek-web42+# The bundler runs the build itself and rewrites the content-hash files in
43+# target/<profile>/assets. A plain `cargo build` leaves the previous bundle
44+# in place, and the server would serve the old css from it — a css change
45+# would pass every check here while the page shows the last build.
46+(cd "$repo" && topcoat asset bundle -p izlek-web)
43 47
44 mkdir -p "$work/config"48 mkdir -p "$work/config"
45 printf 'database = "izlek.db"\nlisten = "127.0.0.1:%s"\n' "$port" > "$work/config/izlek.toml"49 printf 'database = "izlek.db"\nlisten = "127.0.0.1:%s"\n' "$port" > "$work/config/izlek.toml"
crates/izlek-web/tests/http.rsmodified+55 -19
@@ -8268,7 +8268,8 @@ async fn a_clock_saved_on_a_task_renders_in_the_viewers_stored_timezone() {
8268 &[8268 &[
8269 ("task_id", &task),8269 ("task_id", &task),
8270 ("deadline", "2026-09-02"),8270 ("deadline", "2026-09-02"),
8271- ("clock_time", "11:00"),8271+ ("clock_hour", "11"),
8272+ ("clock_minute", "00"),
8272 ],8273 ],
8273 )8274 )
8274 .await;8275 .await;
@@ -8289,7 +8290,8 @@ async fn a_clock_saved_on_a_task_renders_in_the_viewers_stored_timezone() {
8289 .await;8290 .await;
8290 let html = String::from_utf8_lossy(&page.bytes);8291 let html = String::from_utf8_lossy(&page.bytes);
8291 assert!(8292 assert!(
8292- html.contains(r#"<option value="11:00" selected="">11:00</option>"#),8293+ html.contains(r#"aria-label="Hour" value="11""#)
8294+ && html.contains(r#"aria-label="Minute" value="00""#),
8293 "{html}"8295 "{html}"
8294 );8296 );
8295 assert!(html.contains(">Sep 02 11:00<"), "{html}");8297 assert!(html.contains(">Sep 02 11:00<"), "{html}");
@@ -8318,7 +8320,8 @@ async fn a_clock_saved_on_a_task_renders_in_the_viewers_stored_timezone() {
8318 .await;8320 .await;
8319 let html = String::from_utf8_lossy(&shifted.bytes);8321 let html = String::from_utf8_lossy(&shifted.bytes);
8320 assert!(8322 assert!(
8321- html.contains(r#"<option value="14:00" selected="">14:00</option>"#),8323+ html.contains(r#"aria-label="Hour" value="14""#)
8324+ && html.contains(r#"aria-label="Minute" value="00""#),
8322 "{html}"8325 "{html}"
8323 );8326 );
8324 assert!(html.contains(">Sep 02 14:00<"), "{html}");8327 assert!(html.contains(">Sep 02 14:00<"), "{html}");
@@ -8337,7 +8340,8 @@ async fn an_empty_time_clears_the_clock_and_a_clear_clears_both() {
8337 &[8340 &[
8338 ("task_id", &task),8341 ("task_id", &task),
8339 ("deadline", "2026-09-02"),8342 ("deadline", "2026-09-02"),
8340- ("clock_time", "11:00"),8343+ ("clock_hour", "11"),
8344+ ("clock_minute", "00"),
8341 ],8345 ],
8342 )8346 )
8343 .await;8347 .await;
@@ -8385,7 +8389,7 @@ async fn an_empty_time_clears_the_clock_and_a_clear_clears_both() {
8385 .post(8389 .post(
8386 "/api/save_task",8390 "/api/save_task",
8387 Some(&admin_cookie),8391 Some(&admin_cookie),
8388- &[("task_id", &task), ("clock_time", "")],8392+ &[("task_id", &task), ("clock_hour", ""), ("clock_minute", "")],
8389 )8393 )
8390 .await;8394 .await;
8391 assert!(8395 assert!(
@@ -8410,13 +8414,16 @@ async fn an_empty_time_clears_the_clock_and_a_clear_clears_both() {
8410 let html = String::from_utf8_lossy(&page.bytes);8414 let html = String::from_utf8_lossy(&page.bytes);
8411 assert!(html.contains(">Sep 02<"), "{html}");8415 assert!(html.contains(">Sep 02<"), "{html}");
8412 // An empty time renders as no selected step at all — the bare "--".8416 // An empty time renders as no selected step at all — the bare "--".
8413- assert!(html.contains(r#"name="clock_time""#), "{html}");8417+ assert!(
8418+ html.contains(r#"name="clock_hour""#) && html.contains(r#"name="clock_minute""#),
8419+ "{html}"
8420+ );
8414 assert!(!html.contains(">Sep 02 11:00<"), "{html}");8421 assert!(!html.contains(">Sep 02 11:00<"), "{html}");
8415 let saved = app8422 let saved = app
8416 .post(8423 .post(
8417 "/api/save_task",8424 "/api/save_task",
8418 Some(&admin_cookie),8425 Some(&admin_cookie),
8419- &[("task_id", &task), ("deadline", ""), ("clock_time", "")],8426+ &[("task_id", &task), ("deadline", ""), ("clock_hour", ""), ("clock_minute", "")],
8420 )8427 )
8421 .await;8428 .await;
8422 assert!(8429 assert!(
@@ -8454,7 +8461,8 @@ async fn a_title_edit_keeps_the_clock() {
8454 &[8461 &[
8455 ("task_id", &task),8462 ("task_id", &task),
8456 ("deadline", "2026-09-02"),8463 ("deadline", "2026-09-02"),
8457- ("clock_time", "11:00"),8464+ ("clock_hour", "11"),
8465+ ("clock_minute", "00"),
8458 ],8466 ],
8459 )8467 )
8460 .await;8468 .await;
@@ -8511,7 +8519,8 @@ async fn a_description_edit_keeps_the_clock() {
8511 &[8519 &[
8512 ("task_id", &task),8520 ("task_id", &task),
8513 ("deadline", "2026-09-02"),8521 ("deadline", "2026-09-02"),
8514- ("clock_time", "11:00"),8522+ ("clock_hour", "11"),
8523+ ("clock_minute", "00"),
8515 ],8524 ],
8516 )8525 )
8517 .await;8526 .await;
@@ -8570,7 +8579,7 @@ async fn a_time_that_cannot_be_used_is_refused_and_saves_nothing() {
8570 ("task_id", task.as_str()),8579 ("task_id", task.as_str()),
8571 ("title", "Renamed"),8580 ("title", "Renamed"),
8572 ("deadline", "2026-09-02"),8581 ("deadline", "2026-09-02"),
8573- ("clock_time", "not-a-time"),8582+ ("clock_hour", "not-a-time"),
8574 ],8583 ],
8575 )8584 )
8576 .await;8585 .await;
@@ -8602,7 +8611,11 @@ async fn a_time_that_cannot_be_used_is_refused_and_saves_nothing() {
8602 "/api/save_task",8611 "/api/save_task",
8603 Some(&admin_cookie),8612 Some(&admin_cookie),
8604 &format!("/?task={orphan}"),8613 &format!("/?task={orphan}"),
8605- &[("task_id", orphan.as_str()), ("clock_time", "16:20")],8614+ &[
8615+ ("task_id", orphan.as_str()),
8616+ ("clock_hour", "16"),
8617+ ("clock_minute", "20"),
8618+ ],
8606 )8619 )
8607 .await;8620 .await;
8608 let location = answer.location.as_deref().unwrap_or_default();8621 let location = answer.location.as_deref().unwrap_or_default();
@@ -8612,8 +8625,27 @@ async fn a_time_that_cannot_be_used_is_refused_and_saves_nothing() {
8612 );8625 );
8613 let facts = app.store.task(&orphan).await.unwrap().expect("task gone");8626 let facts = app.store.task(&orphan).await.unwrap().expect("task gone");
8614 assert!(facts.row.clock_at.is_none(), "a dayless time was stored");8627 assert!(facts.row.clock_at.is_none(), "a dayless time was stored");
8628+ // And the mirror mistake: a minute with no hour is the same half of
8629+ // nothing.
8630+ let orphan2 = a_task(&app, &admin_cookie, &column, "Orphan Too").await;
8631+ let answer = app
8632+ .post_without_script(
8633+ "/api/save_task",
8634+ Some(&admin_cookie),
8635+ &format!("/?task={orphan2}"),
8636+ &[("task_id", orphan2.as_str()), ("clock_minute", "45")],
8637+ )
8638+ .await;
8639+ let location = answer.location.as_deref().unwrap_or_default();
8640+ assert!(
8641+ location.contains("refusal=bad-clock&on=save_task"),
8642+ "{location}"
8643+ );
8644+ let facts = app.store.task(&orphan2).await.unwrap().expect("task gone");
8645+ assert!(facts.row.clock_at.is_none(), "a lone minute was stored");
8615 }8646 }
8616 8647
8648+
8617 #[tokio::test]8649 #[tokio::test]
8618 async fn a_card_wears_the_clock_chip_in_the_viewers_zone_instead_of_the_deadline() {8650 async fn a_card_wears_the_clock_chip_in_the_viewers_zone_instead_of_the_deadline() {
8619 let app = App::open().await;8651 let app = App::open().await;
@@ -8647,7 +8679,8 @@ async fn a_card_wears_the_clock_chip_in_the_viewers_zone_instead_of_the_deadline
8647 ("title", "Kickoff"),8679 ("title", "Kickoff"),
8648 ("column_id", &column),8680 ("column_id", &column),
8649 ("deadline", "2026-09-02"),8681 ("deadline", "2026-09-02"),
8650- ("clock_time", "14:00"),8682+ ("clock_hour", "14"),
8683+ ("clock_minute", "00"),
8651 ],8684 ],
8652 )8685 )
8653 .await;8686 .await;
@@ -8704,7 +8737,7 @@ async fn a_time_set_on_an_existing_day_writes_both_columns() {
8704 .post(8737 .post(
8705 "/api/save_task",8738 "/api/save_task",
8706 Some(&admin_cookie),8739 Some(&admin_cookie),
8707- &[("task_id", &task), ("clock_time", "16:20")],8740+ &[("task_id", &task), ("clock_hour", "16"), ("clock_minute", "20")],
8708 )8741 )
8709 .await;8742 .await;
8710 assert!(8743 assert!(
@@ -8733,7 +8766,8 @@ async fn a_time_set_on_an_existing_day_writes_both_columns() {
8733 ("title", "Kickoff"),8766 ("title", "Kickoff"),
8734 ("column_id", &column),8767 ("column_id", &column),
8735 ("deadline", "2026-09-10"),8768 ("deadline", "2026-09-10"),
8736- ("clock_time", "09:30"),8769+ ("clock_hour", "9"),
8770+ ("clock_minute", "30"),
8737 ],8771 ],
8738 )8772 )
8739 .await;8773 .await;
@@ -8941,7 +8975,8 @@ async fn the_logs_feed_says_the_clock_in_its_own_words() {
8941 &[8975 &[
8942 ("task_id", &task),8976 ("task_id", &task),
8943 ("deadline", "2026-09-02"),8977 ("deadline", "2026-09-02"),
8944- ("clock_time", "11:00"),8978+ ("clock_hour", "11"),
8979+ ("clock_minute", "00"),
8945 ],8980 ],
8946 )8981 )
8947 .await;8982 .await;
@@ -8991,8 +9026,8 @@ async fn the_datepicker_script_guards_a_panel_with_no_day_input() {
8991 // The moment field's panel: the grid's hidden day input and the time9026 // The moment field's panel: the grid's hidden day input and the time
8992 // box ride the same form.9027 // box ride the same form.
8993 assert!(9028 assert!(
8994- html.contains(r#"name="clock_time" aria-label="Time" data-autosubmit="" data-search="""#),9029+ html.contains(r#"name="clock_hour""#) && html.contains(r#"name="clock_minute""#),
8995- "the moment select lost its searchable chrome: {html}"9030+ "the moment boxes lost their names: {html}"
8996 );9031 );
8997 assert!(html.contains("datepick-input"), "{html}");9032 assert!(html.contains("datepick-input"), "{html}");
8998 }9033 }
@@ -9011,7 +9046,7 @@ async fn an_off_step_clock_renders_itself_not_a_rounded_step() {
9011 .post(9046 .post(
9012 "/api/save_task",9047 "/api/save_task",
9013 Some(&admin_cookie),9048 Some(&admin_cookie),
9014- &[("task_id", &task), ("deadline", "2026-09-02"), ("clock_time", "11:23")],9049+ &[("task_id", &task), ("deadline", "2026-09-02"), ("clock_hour", "11"), ("clock_minute", "23")],
9015 )9050 )
9016 .await;9051 .await;
9017 assert!(9052 assert!(
@@ -9027,7 +9062,8 @@ async fn an_off_step_clock_renders_itself_not_a_rounded_step() {
9027 let page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;9062 let page = app.get(&format!("/?task={task}"), Some(&admin_cookie)).await;
9028 let html = String::from_utf8_lossy(&page.bytes);9063 let html = String::from_utf8_lossy(&page.bytes);
9029 assert!(9064 assert!(
9030- html.contains(r#"<option value="11:23" selected="">11:23</option>"#),9065+ html.contains(r#"aria-label="Hour" value="11""#)
9066+ && html.contains(r#"aria-label="Minute" value="23""#),
9031 "{html}"9067 "{html}"
9032 );9068 );
9033 assert!(html.contains(">Sep 02 11:23<"), "{html}");9069 assert!(html.contains(">Sep 02 11:23<"), "{html}");
style/main.scssmodified+20 -3
@@ -1920,9 +1920,26 @@ img.avatar {
1920 1920
1921 .datepick-panel { width: 190px; }1921 .datepick-panel { width: 190px; }
1922 1922
1923-// The time menu rides the same panel as the day grid; a select's intrinsic1923+// The time row rides the same panel as the day grid: two two-digit boxes
1924-// width is wider than the panel, so it is told to fill, not to size itself.1924+// and a colon between them, one line. An input's intrinsic width is wider
1925-.datepick-panel .field-input { width: 100%; }1925+// than its half, so each box fills its half and centers what is typed.
1926+.datepick-time {
1927+ display: flex;
1928+ gap: 4px;
1929+ align-items: center;
1930+ margin-top: 6px;
1931+}
1932+
1933+.datepick-time .field-input {
1934+ width: 100%;
1935+ min-width: 0;
1936+ text-align: center;
1937+}
1938+
1939+.datepick-colon {
1940+ font-family: var(--font-mono);
1941+ color: var(--ink-soft);
1942+}
1926 1943
1927 .datepick-head {1944 .datepick-head {
1928 display: flex;1945 display: flex;