I want to store list of events in IndexedDB. Each event has start date and end date. Then I need to query today events. I store dates as ISO strings (e. g. 2024-09-15
), so string comparison makes sense.
In SQL it would be something like this:
SELECT * FROM events WHERE startDate >= $1 AND endDate <= $1
But in IndexedDB you cannot make queries so freely.
I’m wondering if there a possibility to either create a composite index and use IDBKeyRange
(composite indices aren’t really well documented) or create some generated field that includes both start and end dates and somehow do ranged queries for it.