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

groovy date arithmetics do not work in pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • workflow-cps-plugin
    • None
    • Jenkins 2.7.4
      Pipeline suite plugin 2.4

      Hi,

      The following date/time arithemetics which work in groovy - do not work in a pipeline script:

      import groovy.time.*
      def startDate = new Date()
      def timeout = startDate  + 1.hours //increment 1 hour
      

      use( TimeCategory ) doesn't help.

      I get the following error:
      groovy.lang.MissingPropertyException: No such property: hours for class: java.lang.Integer

      I also wasn't able to find any workaround for this - I was only able to increment integers (as in days)

            Unassigned Unassigned
            pyrocks Mor L
            Votes:
            8 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: