Skip to content

Conversation

@joshlarson
Copy link
Contributor

@joshlarson joshlarson commented Feb 9, 2026

Scope

Asana Ticket: Trip Planner time display bug

Implementation

  • Turns out, Cldr.Time.Interval.to_string!/4 has some strange behavior when the times given as the two ends of the range
iex> Cldr.Time.Interval.to_string(
...>   ~U[2026-02-09 10:00:43Z],
...>   ~U[2026-02-09 10:03:10Z],
...>   MyApp.Cldr,
...>   format: :medium
...> )
{:ok, "10:00 – 10:03 AM"}

iex> Cldr.Time.Interval.to_string(
...>   ~U[2026-02-09 10:00:43Z],
...>   ~U[2026-02-10 10:03:10Z],
...>   MyApp.Cldr,
...>   format: :medium
...> )
{:ok, "10:00:43 AM"}
  • The fix is to strip the date info off of the time range (which I did in the helper), so that we're passing Time's in rather than DateTime's.
  • (Bonus??) I went rogue a bit and added a +1 superscript when the trip crosses a day boundary.

Screenshots

Screenshot 2026-02-07 at 11 03 44 AM Screenshot 2026-02-07 at 10 32 16 AM

This works in non-English too!

Screenshot 2026-02-07 at 10 32 55 AM

How to test

This is the trip shown in the screenshots above.


@joshlarson joshlarson requested a review from a team as a code owner February 9, 2026 14:32
@joshlarson joshlarson requested a review from lvachon1 February 9, 2026 14:32
@joshlarson joshlarson enabled auto-merge (squash) February 9, 2026 15:11
@joshlarson joshlarson disabled auto-merge February 9, 2026 17:05
@joshlarson joshlarson enabled auto-merge (squash) February 9, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant