I'm trying to build a "logs" table (my goals its to know how much time the app is being used), so I created a function that detects if the user is inactive after a certain period of time.
The table is like this:
dblogs.version(1).stores({
aLogs: "++id, story_id, user_id, session_start, session_end, words_written"
});
So when the user is active I create a new record on aLogs, example:
0, 1 , 19 , 2021/06/30 10:15:10
the user 19
started typing at 2021/06/30 10:15:10
(this goes in session_start) then if the user goes inactive I add the current datetime to session_end
Example:
0, 1 , 19 , 2021/06/30 10:15:10, 2021/06/30 12:15:48
so basically the user estimated time is the difference between those 2 dates (in this case its 2h 0m 38s)
my goal is to have several of these logs, then run a loop on it and story the amount of seconds the user spent "today"
how do I query this on Dexie?
I have tried await dblogs.aLogs.get({session_start : "2021/06/30"});
but it returns undefined
source https://stackoverflow.com/questions/68200023/dexie-how-to-query-by-date
Comments
Post a Comment