Fork me on GitHub
Subscribe 2

Ticket #1089 (open enhancement)

Time formatting in profile.php

  • Created: 2016-07-02 18:05:53
  • Reported by: chris98
  • Assigned to: None
  • Milestone: 1.5.11
  • Component: code
  • Priority: normal

In profile.php, when formatting the time and date the date for the currently logged in user is displayed rather than the options for the user's profile you are viewing.

e.g.

My time zone is set to: UTC Western European, Greenwich, and my time format is set to (from today's date): 19:03:30 and 2nd June 2016.

but when viewing another user profile, for example, they use the Pacific time zone - it shows the time as your own time zone because of the use of format_time().

Would it not be better to display the time formatted correctly for the user profile you are viewing?

History

chris98 2016-07-02 18:09:52

  • Description changed. (Diff)

Franz 2016-07-10 13:28:03

  • Milestone set to 1.5.11.

Good point. Mostly for admins, right?

chris98 2016-07-10 13:45:32

Yes, mostly for admins viewing/editing profiles.

I've taken a look at the function, and the cleanest solution I can think at the moment is to probably add an additional optional argument at the end with the current profile user's timezone, dst, date_format & time_format in an array (those being the keys).

Looking at this actually, it may be worth just adding an additional argument and making this the sole way of formatting time. When you need to use the current user, $pun_user could be passed as an argument rather than being global - which I see as the main benefit. Though I'm not sure whether you'd prefer it global or not.

Franz 2016-07-10 13:55:06

Yeah, might be better to inject the dependencies.