Can I get actual date of update in addition to or instead of number of days?

Added by Wes Christensen almost 8 years ago

When I open an issue, each update starts with a delimiter line that reports how many days ago the update was posted

    Updated by John Doe 8 days ago

Is there any way I can get something like

    Updated by John Doe 8 days ago, 08/15/11 10:14 AM

or

    Updated by John Doe on 08/15/11 10:14 AM, 8 days ago

Thanks

Replies (12)

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Ivan Cenov almost 8 years ago

You may put the mouse over "8 days ago" and a balloon will pop up that contains the exact date and hour.

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Wes Christensen almost 8 years ago

Yes, I did discover that. I meant to mention that in my post. That's certainly helpful, but I would really like to see it displayed. Apparently, there is no way to do that. Thanks.

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Ivan Cenov almost 8 years ago

I investigated for a while...

The code that displays the time stamp is in \path_to_redmine\app\views\issues\show.rhtml, lines 11-16. Methods 'authoring' and 'time_tag'. 'authoring' calls 'time_tag'. So, if the call of 'time_tag' is replaced by some other appropriate method this could achieved.

RE: Can I get actual date of update in addition to or instead of number of days? - Added by John Pels over 7 years ago

Just needed to do this myself, and tracked down where to change it.
I'm running v1.1.2.stable:

In /app/helpers/application_helper.rb, line 305


def time_tag(time)
- text = distance_of_time_in_words(Time.now, time)
+ text = "on #{format_time(time)}, #{distance_of_time_in_words(Time.now, time)}"

This will result in displaying your second choice, "Updated by John Doe on 8/15/2011 10:14AM, 8 days ago". Link and on hover balloon still present.

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Chris Bellis almost 7 years ago

I tried to apply this change to a Bitnami Redmine appliance running
Redmine version 2.0.2.stable
Ruby version 1.8.7 (x86_64-linux)
Rails version 3.2.5
Environment production
Database adapter MySQL

The authoring and time_tag methods appeared to be the same just at a different line number in the file specified above. I'm pretty green when it comes to Ruby and Rails, but could someone offer some tips?

Thanks

RE: Can I get actual date of update in addition to or instead of number of days? - Added by William Roush almost 7 years ago

Chris Bellis wrote:

I tried to apply this change to a Bitnami Redmine appliance running
Redmine version 2.0.2.stable
Ruby version 1.8.7 (x86_64-linux)
Rails version 3.2.5
Environment production
Database adapter MySQL

The authoring and time_tag methods appeared to be the same just at a different line number in the file specified above. I'm pretty green when it comes to Ruby and Rails, but could someone offer some tips?

Thanks

That should be fine to edit, I don't think that part of the code has changed... worse that happens you'll roll back your changes. :)

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Chris Bellis almost 7 years ago

I am still getting the lines as:
"Added by project manager about 22 hours ago. Updated about 21 hours ago." Each update within the issue also has the Updated about XX hours/minutes ago.

The method now looks like this (from application_helper.rb):

def time_tag(time)

text = "on #{format_time(time)}, #{distance_of_time_in_words(Time.now, time)}"
if @project

link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => User.current.time_to_date(time)}, :title => format_time(time))

else

content_tag('acronym', text, :title => format_time(time))

end

end

I also tried rebooting the server and then without the quotes. Any suggestions?

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Fred Giusto over 6 years ago

I made this :

def time_tag(time)
text = distance_of_time_in_words(Time.now, time) + " (" + format_time(time) + ")"
if @project
link_to(text, {:controller => 'activities', :action => 'index', :id => @project, :from => User.current.time_to_date(time)}, :title => format_time(time))
else
content_tag('acronym', text, :title => format_time(time))
end
end

I have (in french) : il y a environ 3 mois (30/10/2012 14:52)

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Michael Barry 2 months ago

Sorry for digging up a very old ticket...
I'm curious about how one would implement this customization.

Would you have to modify the main "application_helper.js" file directly?

OR

Can you incorporate the code simply by adding it to file named "theme.js", and dropping it into the <theme>/javascripts/ folder?

(If the latter, and if starting from a blank theme.js file, would you only need the few lines of code pertaining to "time_tag(time)"? Or does the theme.js file need any other information in it?)

  def time_tag(time)
    text = distance_of_time_in_words(Time.now, time) + " (" + format_time(time) + ")" 
    if @project
      link_to(text, project_activity_path(@project, :from => User.current.time_to_date(time)), :title => format_time(time))
    else
      content_tag('abbr', text, :title => format_time(time))
    end
  end

(I'm running 4.0.3...the original code was taken from /app/helpers/application_helper.rb and modified using Fred Giusto's syntax for line 2.)

Thank you.

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Bernhard Rohloff 2 months ago

Michael Barry wrote:

Sorry for digging up a very old ticket...
I'm curious about how one would implement this customization.

Would you have to modify the main "application_helper.js" file directly?

OR

Can you incorporate the code simply by adding it to file named "theme.js", and dropping it into the <theme>/javascripts/ folder?

(If the latter, and if starting from a blank theme.js file, would you only need the few lines of code pertaining to "time_tag(time)"? Or does the theme.js file need any other information in it?)

[...]

(I'm running 4.0.3...the original code was taken from /app/helpers/application_helper.rb and modified using Fred Giusto's syntax for line 2.)

Thank you.

The code you mentioned is written in Ruby not JavaScript so you wont be lucky with putting it into a theme folder. I'd rather suggest you to override the method within a plugin.
You can find information about plugin development in the Developer_Guide.

Kind regards,

Bernhard

RE: Can I get actual date of update in addition to or instead of number of days? - Added by Michael Barry 2 months ago

I goofed up here..I confused ruby and javascript, mashing them together as if they were the same.
(And the file is "application_helper.rb", not "application_helper.js".)

Thank you for the clarification, Bernhard. And for the tips on looking into addressing this with a plugin.

Regards,
Mike

(1-12/12)