Opened 9 years ago

Closed 6 years ago

# [patch] Admin "Last Login" users info should use correct time zone

Reported by: Owned by: s0undt3ch hasienda normal AccountManagerPlugin trivial timezone locale 0.11

### Description

Or, as an alternative, start using pretty_timedelta?

Have the pretty_timedelta as an extra option?

### comment:1 follow-ups: ↓ 2 ↓ 3 Changed 9 years ago by s0undt3ch

Hmm, apparently format_datetime respects the admin's TZ even if no tzinfo is passed.

I tried both:

format_datetime(last_visit, tzinfo=req.tz)


and:

format_datetime(last_visit)


Same results.

Guess the ticket is now just about the pretty_timedelta

### Changed 9 years ago by s0undt3ch

Just as a sugestion

### comment:2 in reply to: ↑ 1 Changed 8 years ago by tiamot

Hmm, apparently format_datetime respects the admin's TZ even if no tzinfo is passed.

I'm new to trac. What does this mean? It seems to me as if you are saying that using the format command, you can get the correct timezone to display ( in reports? ).

Can you also use the format command you describe to fix the timezone on the Admin tab?

If so, which file do I need to edit to affect the change?

P.S. I use trac 0.10

### Changed 8 years ago by manski

Patch against r5836 and Trac 0.11.4

### comment:3 in reply to: ↑ 1 Changed 8 years ago by manski

Hmm, apparently format_datetime respects the admin's TZ even if no tzinfo is passed.

I tried both:

format_datetime(last_visit, tzinfo=req.tz)


and:

format_datetime(last_visit)


Same results.

Guess the ticket is now just about the pretty_timedelta

At least in Trac 0.11.4 this is not true. The results are different (see trac.util.datefmt.format_datetime which says tz = tzinfo or localtz). So I've added a patch that fixes this "problem" with req.tz and format_datetime.

Btw. I think it's not such a good idea to use a relative timestamp here.

### comment:4 Changed 6 years ago by hasienda

• Owner changed from mgood to hasienda
• Status changed from new to assigned
• Summary changed from Admin Last Login Users Info should use req.tz to [patch] Admin "Last Login" users info should use correct time zone

I've seen this working with Trac 0.12 without a patch.

I'll add the patch to correct this for older Trac as seems to be required. It'll not hurt anyway.

pretty_timedelta get's a clear 'wontfix' from me as well. While the value could be disputed in general, IMHO this is certainly not helpful at all in this use case.

### comment:5 Changed 6 years ago by hasienda

• Resolution set to fixed
• Status changed from assigned to closed

(In [9240]) AccountManagerPlugin: Use Trac's time zone setting to display time stamps correctly, closes #3086.