Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-22536

Date in changeset is in wrong format

    XMLWordPrintable

Details

    Description

      Please see below full problem 'thread'

      Actually, if the date is being returned from the Git plugin as 1970-01-17T04:01:10+0000 +0300), parsing and reformatting won't work. I think you need to open a bug against the Git plugin.

      slide

      On Tue, Apr 8, 2014 at 5:37 AM, Nir Reuveny wrote:
      Hi,

      I hope someone can help with this…

      We use custom jelly email template, and it used to work fine. (it works if I roll back the git-plugin to 2.0.1), the date is showing as below in the email (seems like wrong unix time conversion)
      CHANGES
      by XXX:1970-01-17T04:01:10+0000 +0300)
      this is an example of an email when we roll back to git-plugin 2.0.1:
      by XXX:2014-03-24 16:54:00 +0200)
      this is the section in the jelly template we use:
      <j:forEach var="cs" items="${changeSet}" varStatus="loop">
      <j:set var="hadChanges" value="true" />
      <j:set var="aUser" value="${cs.hudsonUser}"/>
      <TR>
      <TD colspan="2" class="bg2">${spc}by
      <B>${aUser!=null?aUser.displayName:cs.author.displayName}: </B>
      <B>(${cs.date})</B>
      <B>${cs.msgAnnotated}</B>
      </TD>
      I opened a bug and got the below reply… can anyone help here? I’m really unsure exactly what to do… I’m not a developer…
      Thanks!
      ——
      Looks like the git plugin changed the date format they used. https://github.com/jenkinsci/git-plugin/commit/430bdc9b6ed121d653ef2633d2109b259aa8687b
      added a comment - 08/Apr/14 11:40 AM
      So what can we do to get the correct format using the email-ext plugin?...
      added a comment - 08/Apr/14 11:42 AM
      Since the getDate() method returns a string, you'd have to parse the string back into a date object and then format the date how you want. If you need additional help, please use the mailing list as this is not a bug.

      You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
      For more options, visit https://groups.google.com/d/optout.


      Website: http://earl-of-code.com

      You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
      For more options, visit https://groups.google.com/d/optout.

      Attachments

        Issue Links

          Activity

            Mark,

            I'm not sure that just "removing" the original timezone offset is the way to go. What I've done so far is here: https://github.com/alecharp/git-plugin/commit/c04174ee94e8e6765b1d2bdaea0beeb291678ab8

            In the documentation here (https://www.kernel.org/pub/software/scm/git/docs/git-commit.html#_date_formats), the dates in seconds from EPOC may have a timezone offset, which is important. Just removing it shouldn't convert correctly the date. What do you think?

            alecharp Adrien Lecharpentier added a comment - Mark, I'm not sure that just "removing" the original timezone offset is the way to go. What I've done so far is here: https://github.com/alecharp/git-plugin/commit/c04174ee94e8e6765b1d2bdaea0beeb291678ab8 In the documentation here ( https://www.kernel.org/pub/software/scm/git/docs/git-commit.html#_date_formats ), the dates in seconds from EPOC may have a timezone offset, which is important. Just removing it shouldn't convert correctly the date. What do you think?
            markewaite Mark Waite added a comment -

            alecharp I agree that removing the timezone information completely does not seem like the right thing to do, since timezone information is there. When I looked at it, it seemed there was an extra timezone definition appended to the end of the date. That meant it had two (sometimes conflicting) timezone definitions in the date. I thought that two timezone definitions in one time field were probably not right.

            markewaite Mark Waite added a comment - alecharp I agree that removing the timezone information completely does not seem like the right thing to do, since timezone information is there. When I looked at it, it seemed there was an extra timezone definition appended to the end of the date. That meant it had two (sometimes conflicting) timezone definitions in the date. I thought that two timezone definitions in one time field were probably not right.

            Yes, two timezone offset is not right, but I'm not sure that using the one from the `new Date()` is correct. As the project already depends on `joda-time`, my patch use it and normally the `DateTime` and `DateTimeZone` should correct that.

            I made my changes based on git-2.2.6 tag, but it's quite easy to move it to HEAD. But, as the git-plugin need 1.568 core now, I'd like to be able to backport this to the latest version compatible with the previous required core version.

            alecharp Adrien Lecharpentier added a comment - Yes, two timezone offset is not right, but I'm not sure that using the one from the `new Date()` is correct. As the project already depends on `joda-time`, my patch use it and normally the `DateTime` and `DateTimeZone` should correct that. I made my changes based on git-2.2.6 tag, but it's quite easy to move it to HEAD. But, as the git-plugin need 1.568 core now, I'd like to be able to backport this to the latest version compatible with the previous required core version.
            markewaite Mark Waite added a comment -

            alecharp could you evaluate git plugin 2.4.0 and git client plugin 1.18.0 in the context of this bug report? They were released 18 Jul 2015.

            markewaite Mark Waite added a comment - alecharp could you evaluate git plugin 2.4.0 and git client plugin 1.18.0 in the context of this bug report? They were released 18 Jul 2015.
            markewaite Mark Waite added a comment -

            Assuming this was fixed in git client plugin 1.18.0 and git plugin 2.4.0, released 18 July 2015

            markewaite Mark Waite added a comment - Assuming this was fixed in git client plugin 1.18.0 and git plugin 2.4.0, released 18 July 2015

            People

              Unassigned Unassigned
              nreuveny Nir Reuveny
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: