Skip to content

Instantly share code, notes, and snippets.

@katafrakt
Created May 23, 2025 07:48
Show Gist options
  • Save katafrakt/76ccec88a4af5c96b89d32007473756f to your computer and use it in GitHub Desktop.
Save katafrakt/76ccec88a4af5c96b89d32007473756f to your computer and use it in GitHub Desktop.
start_time = ~U[2025-05-23T09:21:17Z]
s1 = session_fixture(started_at: start_time)
s2 = session_fixture(started_at: DateTime.add(start_time, 60))
s3 = session_fixture(started_at: DateTime.add(start_time, 160))
s4 =
session_fixture(
started_at: DateTime.add(start_time, 245),
finished_at: DateTime.add(start_time, 305)
)
# after
start_time = ~U[2025-05-23T09:21:17Z]
add_time = fn seconds -> DateTime.add(start_time, seconds) end
s1 = session_fixture(started_at: start_time)
s2 = session_fixture(started_at: add_time.(60))
s3 = session_fixture(started_at: add_time.(160))
s4 = session_fixture(started_at: add_time.(245), finished_at: add_time.(305))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment