Repository navigation
AP-482: Preserve local item times across DST transitions - #30
anarchivist wants to merge 5 commits into
Conversation
Build found timestamps from the entered local date and time so daylight saving transitions do not shift the saved clock time. Cover spring and fall create and update flows with shared examples. Co-authored-by: Codex GPT-6.1-sol <noreply@openai.com>
Use Timecop's block form to restore the clock after each create/update example. Keep travel semantics so time can advance for assertions about updated_at. Define the normal test time with let and override it in the spring and fall daylight saving contexts. This exercises transition dates in the standard suite and removes the RSPEC_FORCE_DST_FAILURE switch, its helper methods, and the direct TZInfo require. Preserve the fixed UTC expectations for both create and update requests. Verified through Docker Compose: 16 item request examples and 165 full-suite examples passed; RuboCop passed. Co-authored-by: Codex GPT-6.1-sol <noreply@openai.com>
Reject local times that do not exist during the spring daylight saving transition before attaching images or saving items. Show a clear error, return HTTP 422 for failed creates, and preserve submitted form values so staff can correct the time. Continue to use the first Pacific Daylight Time occurrence of a repeated fall hour, explain that rule on both item forms, and assert its UTC value for create and update requests. Use application-zone Date.current and Time.current values in CSV import and view specs. Share Timecop setup through running and frozen RSpec contexts, and pin the CSV import clock for deterministic cutoff tests. Extend the DST shared examples to cover the skipped spring hour and repeated fall hour, including rejection without changing an existing item. Wait for the validation message in the staff system spec before checking the rendered page to avoid a Selenium navigation race. Verified through Docker Compose: 170 full-suite examples and 21 item request examples passed; RuboCop passed. Co-authored-by: Codex GPT-6.1-sol <noreply@openai.com>
awilfox
left a comment
There was a problem hiding this comment.
The change is mostly good, and the test cases are very thorough (thanks!), but I have a few items before merge.
| <%= form.label(:time_found, 'Time found:', class: 'control-label') %> | ||
| <%# TODO: figure out why we can't just pass datetime_found %> | ||
| <%= form.time_field :time_found, value: @item.datetime_found&.strftime("%T.%L") %> | ||
| <%= form.time_field :time_found, value: (params.key?(:time_found) ? params[:time_found] : @item.datetime_found&.strftime("%T.%L")), aria: { describedby: 'time_found_hint' } %> |
There was a problem hiding this comment.
It's a decent hint (and partially solves the documentation question I had above, but I'd still like it documented in the README for devs that may not see this since it's only in edit), but I'm not sure if this is a good describedby on its own.
I'd lean towards this being aria-details, but I'd want an expert's opinion first.
There was a problem hiding this comment.
@jxloesberg - any thoughts? (i know you're out next week.)
There was a problem hiding this comment.
i'm switching this to aria-details in 91db2b3 based on looking at the ARIA attribute documentation. we can certainly fix it in the future.
There was a problem hiding this comment.
I agree, aria-details is the way to go here.
awilfox
left a comment
There was a problem hiding this comment.
r+ pending the ARIA thing. You could take the ARIA markup off and leave the hint itself if you want to merge now, and we can add it in once we have the answer on which one it belongs as. The text is still there for people to read (or have spoken), it's just not fully attached to the element. ("no ARIA is better than bad ARIA")
Summary
Date.currentandTime.current. Share Timecop setup for an advancing request clock and a frozen CSV import clock, and wait for the validation result in a staff system spec before checking the page.Verification
Time-entry convention
The time field is optional. During the repeated fall hour, the app uses the first occurrence (PDT); the current form does not offer a choice for the second occurrence.