Project

General

Profile

Modifier affichage "il y a xx jours" en date réelle / convert duration to real date format

Added by Xavier Soum over 8 years ago

Bonjour, Hello,

je souhaiterais que Redmine affiche par exemple :
I would like Redmine displays for example:

Ajouté par Mr Tartampion le 17/05/2016 16:22. Mis à jour 09/06/2016 17:05.

au lieu de :
instead of :

Ajouté par Mr Tartampion il y a 27 jours. Mis à jour il y a 4 jours.

En fait c'est le texte qui se trouve dans la pop-up (quand on met la souris sur la durée) que j'aimerais afficher directement.
Actually I want to display the text which is in the pop up.

Comment procéder svp?
How to proceed please?

Xavier


Replies (4)

RE: Modifier affichage "il y a xx jours" en date réelle / convert duration to real date format - Added by Martin Denizet (redmine.org team member) over 8 years ago

Hello Xavier,

I answer in English for more people to be able to read.

I think there are 2 options:

1: Using Javascript

Use JS to alter the display at runtime.
Links look like that:

<a href="/projects/redmine/activity?from=2010-12-12" title="2010-12-12 14:07">over 5 years</a>

It's very simple to have jQuery code to take the title attribute (2010-12-12 14:07 here) and set it as content of the tag.
I wrote a plugin to inject JS without making a custom plugin.

2: Making a custom plugin

That's the hard but cleaner way. Let me know if you wish more details.

Cheers,

RE: Modifier affichage "il y a xx jours" en date réelle / convert duration to real date format - Added by nadia nadia over 8 years ago

Hello,

I have the version 3.1.0, would you please show me how to changed it.

Thanks in advance.

RE: Modifier affichage "il y a xx jours" en date réelle / convert duration to real date format - Added by Martin Denizet (redmine.org team member) over 8 years ago

In JavaScript, I'd do:

$(function() {
    $('#history .has-notes h4 a[title]').each(
        function(){
            //Swap date and time ago
            var date=$(this).attr('title');
            $(this).attr('title',$(this).text());
            $(this).text(date);

            //Remove "ago" 
            $(this).parent().contents().filter(
                function(){
                    return this.nodeType==3;}
                ).last().remove();
        }
    );
});


You can easily inject JavaScript using my plugin

This code will replace:

Updated by George Gensure about 3 years ago

With:
Updated by George Gensure 2013-07-16 17:58

Cheers,

    (1-4/4)