How do I set the time zone in Trac? - timezone

I am struggling with setting up time zones with Trac. I have searched around but I have found nothing helpful. What can I do?
Both a whole site timezone or a per-user timezone settings would be helpful.

Like indicated by others, the solution is to add this to trac.ini:
[trac]
default_timezone = ...
But the tricky thing is the formatting (see http://trac.edgewall.org/ticket/9581):
you can either use GMT +xx:xx format (simple but not time saving aware)
or enter a timezone name e.g. America/Los_Angeles which requires pytz to be installed - see http://trac.edgewall.org/wiki/PyTz.

Default timezone for whole site is set up in the trac.ini:
[trac]
default_timezone = ...
In user preferences you have date time preferences («base_url»/prefs/datetime), where user can set his own (per user) timezone.
See for example http://trac.edgewall.org/prefs/localization

To set the site default timezone, edit trac.ini with the following syntax:
[trac]
default_timezone = GMT +10:00
or
[trac]
default_timezone = GMT -7:00

Related

fullcalendar - Set current date based on timezone

There have been a couple of similar questions in the past, but none I've found have been fully answered so let me try again.
I'm writing this web app where users can select their particular timezone, which might be different from the one set up in their respective system. Say my computer is set to the "America/New_York" timezone. If I (for whatever reason) set up my timezone configuration to "Asia/Tokyo" within the web app, I would like to:
have the current month aligned with the configured timezone ("Asia/Tokyo") and
have the highlighted current date also set to the "Asia/Tokyo" timezone.
I've tried many different configurations without any luck...
$("#calendar").fullCalendar({
defaultView: "month",
timezone: "Asia/Tokyo",
ignoreTimezone: false,
defaultDate: moment("2019-03-10"),
header: {...
In this case, I'm hard coding the defaultDate for tomorrow ("2019-03-10") to see if the current date highlight changes to no avail.
Is there a way to accomplish these two issues?
Update:
Okay, the answer to question (2) I found to be the parameter now. In this case, things would look like...
$("#calendar").fullCalendar({ defaultView: "month", now: moment().tz("Asia/Tokyo"), ...
As explained above, if say, my laptop is said to be configured with the "America/New_York" timezone, but I'm actually in Japan and my web app config reflects that, it won't matter. fullCalendar will now show the correct day for Today.
Still, the question remaining is (1): How to make the (monthly) calendar days be in sync with a given timezone? Thanks!

ASP.NET Boilerplate - How to add Timezone to user profile

The user profile page doesn't appear to allow the user to specify their timezone. How should we add this feature so the user can select and save their timezone and then have the web pages display the localised date?
Times are displaying in my browser according to the location of the server, so I edit a record at 7am local time, and it appears as if I edited it 4 hours in the future :)
Best solution for me is to allow the user to specify their timezone on their profile and then have this setting reflected in times displayed in the UI.
I'm set Clock.Provider to the UTC in file Startup.cs of ...Web.Host is OK
// using Abp.Timing;
public Startup(IHostingEnvironment env)
{
// Set Clock.Provider as UTC:
Clock.Provider = ClockProviders.Utc;
//_appConfiguration = env.GetAppConfiguration();
}
If Angular not sent date UTC you can using:
yourDate = abp.timing.convertToUserTimezone(yourDate); // to convert yourDate to date UTC.
You need to set the Clock.Provider to the UTC clock on the server. The documentation tells you that you need to set it but doesn't really tell you where. You just need to set this during the startup process. Here is a link to the docs that touch on it briefly.
Timing Documentation
Hope that helps.

ToLocalTime shows wrong time

I am running a website in IIS on my local PC, I save a date as UTC and call .ToLocalTime() on it in the front end mvc website. If I run the website on my local PC it outputs the correct date and time adjusted for DST. If I run it in Azure in region UK West I get 1 hour behind. This hasn't been an issue until today i.e. the clocks changed on Saturday. Do I need to raise a ticket with Azure? Or am I doing it wrong?
Azure App server is using UTC time. If your site is not global just for UK. We can use the following code to get the UK local time.
DateTime utcNow = DateTime.UtcNow;
TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time"); //UK time zone
DateTimeOffset time = TimeZoneInfo.ConvertTimeFromUtc(utcNow, tz);
lab_time.Text = time.DateTime.ToString(CultureInfo.InvariantCulture); //display the datetime with label.
If your website is to be global that you may need to use javascrpt to do that, more detail please refer to another SO Thread.
Time-zone depends on the the server location literally.
I had faced the same issue. I had my server in Singapore and it used to clash with my zone, India.
It would affect the time and date formats too.
So, Better not use the ToLocalTime() at the server side. just get the UTC time from the server and convert to whatever local time at the client side. Issue resolved!
Hope this helps. Thank you.

Grails - Convert Server (UTC Date) to User Date in Controller

I'm trying to convert some dates that I have stored on the server (in UTC). I'd like to convert them to the user's time so it would be pretty for their time zone.
However, I'm not sure about how to go about doing that. What's the best practice to get the user's timezone from the request in the controller?
The timezone is not passed in the request headers. If you had the users time zone stored in a profile setting then you can easily format the date according to this but its not something you can just grab from the request. There are ways to do this in JavaScript.

Grails Fullcalendar Timezone Issue

I am sitting on a really strange issue with grails and the js fullcalendar.
I have users which have their own timezones stored in the database e.g. ECT
When users insert their events all dates are stored in UTC. This is set in the Bootstrap with:
TimeZone.setDefault(TimeZone.getTimeZone("UTC"))
I heard its a good idea to store all dates in UTC. So when a german user is entering 1.12.2012 08:00 its stored with 1.12.2012 07:00. This is fine.
Now when I want to display those values from the db into the calendar the timezone is not considered by fullcalendar(i set ignoreTimezone: false) so the dates are comming over json with 2012-12-01 08:00+01:00 but its display as 08:00 am and not 07:00. What am I doing wrong here? this issue is driving me really crazy.
Can you check in by manually adding the event in javascript?I guess the problem is with the JSON format. The parseISO8601 function inside fullcalendar.js expects your object to be in some format and so if your format is not correct,then you have to experiment and see what works.
Quoted from fullcalendar website.
When specifying Event Objects for events or eventSources, you may
specify a string in IETF format (ex: "Wed, 18 Oct 2009 13:00:00 EST"),
a string in ISO8601 format (ex: "2009-11-05T13:15:30Z") or a UNIX
timestamp.

Resources