React Table shows entries based on User Time zone not UTC - utc

I have a table (react/Nodejs) which reads the entries from db and list it in the table. All entries in db are UTC, however depending on the user time zone the table is showing different data. For example in the attached snapshot our week on header is from Sep 19 to Sep 25 but the table shows Sep 26 entry which is outside of the range. That only happens with users on (UTC-xxx) time and not for user on (UTC+xxx). Your help is appreciated? Table Image

Use a timezone library to render it with a specific timezone
The problem is caused when formatting the object to be rendered in the UI, so probably the method you are using is as you say taking into account the users timezone and not a specific one that you set.
To achieve this, you can use a library like moment timezone. Or a variant compatible with your libraries.
Hope it helps.

Related

While sending data in JSON, the date changes to previous day

Saving the data in one function call, where I am sending the data as 2019-02-01T00:00:00.000Z but the fiddler shows the different date in JSON as 2019-01-31T18:30:00.000Z. I am not aware that why it is giving the difference of 5 hrs 30 minutes.
On the local case, date saved in the database is 01-02-2019, while on production environment the previous date is getting saved in the table records.
Thanks in advance. Please help me with the solutions.

How do you get the ticket created date in trac?

I want to play with some really simple queries for a report, but I want to group everything by the creation date. The problem I am having is that time exists in the database, but not the date. From searching around in trac-related resources, it looks like I need to install trac.util.datefmt to be able to extract this information from datetime(time). I can find the API documentation for trac.util.datefmt, but not a download link to get the .egg.
Am I going in the right direction? If I can do what I need (i.e. get the creation month/day/year) without a plugin, what column do I use? I don't see anything else in the schema that is reasonable. If I do need trac.util.datefmt, where do I download it from? And if I really need a different plugin, which one should I be using?
I'll assume Trac >= 1.0. The time column is unix epoch time: the number of seconds that have elapsed since January 1st 1970. You can divide the value by 1e6 and put the value in a converter to see an example of extracting the datetime from the time column. trac.util.datefmt is part of the egg that ships with Trac, but since you are working with reports it doesn't sound like you need to know more about that function to accomplish your aim.
In a Trac report the time column will be automatically formatted as a date. You can look at the default report {1} as an example. I'm not sure how you intend to group by creation date. Do you wish to group tickets created in a certain datetime range?

Generic TimeZone According to login user location

I want that all DateTime Objects come from Model may converted to Local of login user. All Datetime are stored in UTC format in Database.
For Example
If someone Create user and CreatedDate is stored in UTC.Now(2014-05-06 01:00PM);
Then someone login from Pakistan and navigate to users view then the DateTime must show as 2014-05-06 06:00PM for last created user.
I know how to convert but which is the best approach to do it. I want to convert all datetime coming from Database into current ..
I saved all My date formats in DateTime.UtcNow
and add 1 column TimeZoneId in DB and check it whenever some results are need to be shown on view or any thing want to manipulate according to timezone of current user.

Teradata SQL Timezone adjustments

I have a database where I can see actions taken by users. These actions have a timestamp. All the timestamps are in EST.
Let's say the action is, downloading content.
I need to find, x amount of users downloaded content y in GMT(these users are in GMT).
I need to find, x amount of users downloaded content y in PST(these users are in PST).
I have the mapping of countries etc. However, I can't find a good query which creates a table with the timezone mappings for the database.
Can anyone give me an idea on how I would do the conversion in SQL and point me in the direction of a query which recreates the timezone mapping table.

Timezone-affected rails 3 app

UPDATE:
Copied from comment made below:
I thought about using a web service against IP address for each visitor to the site but then I wondered about users looking at meetings in locations that span timezones so the timezone has to be associated with the location of the meeting being viewed, not where the user themselves are at that moment in time. I need a user to be able to see a list of meetings (with times and locations) and the times shown are the actual meeting times but the WHERE clause of the SELECT to list the meetings needs to take into account the timezone of each meeting location.
I've looked around and there are plenty of questions asked about using timezones with a rails app.
The issue lies in the fact that the app needs to know which timezone a user is in for it to properly be able to run queries against the database to check for datetimes in the future, for instance.
I don't want regular visitors to my site to need to login for it to work correctly for them so I'm thinking along the following lines:
Admin users login to post an item for a particular location and datetime
When saving the item it uses the [lat,lng] of the location to call the Timezone gem to capture the timezone for the location
I think I need this timezone to be added to an extra field on the same model as the [lat,lng] and the datetime (which rails saves as UTC) ( https://stackoverflow.com/a/2533323 )
I need my model to combine the UTC datetime with its respective timezone so that when a regular user comes to the site the webpage selects items where the UTC+timezone datetimes are in the future
Does that sound possible/correct?
If it sounds confusing just say in a comment and I'll try to reword it a bit better if I can.
Can someone offer any code for the model to create a virtual attribute (I think) that combines UTC datetime with a timezone field?
Thanks
Won't it be better to have the list of countries and their timezones? When user comes to site determine from what country he is and than trying to use native rails timezone methods.
For example I have User and Table models that have created_at params:
Time.zone => (GMT+00:00) UTC
User.last.created_at => Mon, 25 Jun 2012 21:17:25 UTC +00:00
Table.last.created_at => Mon, 16 Jul 2012 14:08:17 UTC +00:00
Time.zone = 'Moscow' => "Moscow"
Time.zone => (GMT+04:00) Moscow
User.last.created_at => Tue, 26 Jun 2012 01:17:25 MSK +04:00
Table.last.created_at => Mon, 16 Jul 2012 18:08:17 MSK +04:00
How to determine the country you should look for gems or some services. I think it will be the service that determine the user country by his IP address.