In my database, I have a list of users with the user ids and their UTC offset in minutes. It's in a PostgreSQL database which I access through sequelize in my node application.
For example:
ID, offset
1, -540
2, -330
...
...
I want to create a query that, when run, gets me a list of users that have passed 12pm noon their local time.
For example, when UTC time is 7am and we run the query, then for user Id 2, the local time is 12:30pm, and for userId 1, the local time is 4pm. So, the query will get me [1,2]
However, when UTC time is 5am and we run the query, then for user 1, the local time is 1pm, but for user 2, the local time is 10:30am. So the query result will be [1].
I'm confused about how to structure my code to make this happen. I don't need the syntax. I just need the logic for how I should form my query or my sequelize code.
Any help is appreciated.