How to filter the data on a month based on the time zones users?

I am using MongoDB database
For example an entry with date and time in UTC at night. In UTC the entry may take another day.
I need to filter further for example, the entries by months. There is a risk that some data will terauda due to the fact that different time zones. In such cases, to do? Like let the user to filter the records in his time zone?
March 23rd 20 at 19:06
1 answer
March 23rd 20 at 19:08
Record time zone as +03 or -07, and in the filter add or subtract the time zone value to the utc value.
ie, in the dB a value of 14:00, when you filter all records older than or equal to 14:00 time user
for utc time >= 14:00
for +03 time >= 17:00
for -07 time >= 07:00
let query = {
 "createdAt": {
 $lte: "2019-06-01T00:00:00+03",
 $gte: "2019-06-30T23:59:59+03"

So? - Jett commented on March 23rd 20 at 19:11
@Jett, XS, do not remember how Mongo works with dates. Like
const userTZ = getUserTZ() || '+0300'
let query = {
 "createdAt": {
 $lte: new Date(`2019-06-01 00:00:00${userTZ}`),
 $gte: new Date(`2019-06-30 23:59:59${userTZ}`)

The idea of calling new Date must parse the time string, convert to utc and then return the view according to the time zone that the server in the monga needs to store dates. If as is often the case stupid unix time, just +new Date(`2019-06-01 00:00:00${userTZ}`) it will cast the date to an int with unix time - Tanya.Turn commented on March 23rd 20 at 19:14

Find more questions by tags MongooseNode.jsMongoDBJavaScript