Skip to content

Conversation

@ajmsawers
Copy link

Summary

This PR fixes incorrect and inconsistent behavior in FireFly UI's time filtering.
Custom start/end ranges now work end-to-end, and all outgoing queries now match
the exact FireFly API format (unix seconds, operators in the value, two params
for ranges). Histograms now respect custom endTime, and API errors no longer
crash components.

Fixes #173.


What Was Broken

  • Custom time ranges silently failed.
  • Query params used invalid formats (created>=... as a key or encoded bracketed ranges).
  • FireFly rejected requests with 400 errors.
  • Histograms always assumed "now" as the end timestamp.
  • Some components crashed on empty/invalid API responses.

What This PR Changes

1. Time filter model + utils

  • Added startTime and endTime to ITimeFilterObject.

  • Added a custom enum option.

  • Rebuilt parsing to generate unix seconds.

  • Query params now use FireFly’s required format:

    • Start only: &created=>=<unix>
    • End only: &created=<=<unix>
    • Range: &created=>=<start>&created=<=<end>

This resolves no-op filters and 400s.

2. Search param handling

  • Normalizes startTime / endTime in URL params.
  • Falls back to the 24h preset when invalid.

3. Custom Range UI

  • Added modal with two validated datetime-local inputs.
  • Ensures at least one bound; validates start ≤ end.
  • Defaults to last 24h → now.
  • Writes clean search params that flow to the filter object.

4. Lists + histograms

  • All lists automatically pick up corrected filter strings.
  • Histograms use custom endTime when present.

5. Error handling

  • fetchCatcher now throws on non-OK responses.
  • Handles empty bodies safely.
  • Transfers view guards against missing/empty responses.

Result

  • Custom windows and presets work reliably.
  • Queries match FireFly’s expected format.
  • Histograms reflect the actual selected range.
  • API errors surface via snackbar instead of crashing.

All commits are DCO-signed.

@ajmsawers
Copy link
Author

Happy to adjust anything during review — feel free to let me know!

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.

Start/Stop times in query params

1 participant